import java.util.Scanner;

public class ShapeCalculator {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int a = sc.nextInt();  
        int b = sc.nextInt();  
        int c = sc.nextInt();  
        int squareSide = sc.nextInt();  

        if (a <= 0 || b <= 0 || c <= 0 || squareSide <= 0) {
            System.out.println("Invalid input");
            return;
        }

        double perimeterTriangle = a + b + c;

        double s = perimeterTriangle / 2.0;
 
        double areaSquare = squareSide * squareSide;
        double perimeterSquare = 4 * squareSide;

        System.out.printf("%.2f\n", areaTriangle);
        System.out.printf("%.2f\n", perimeterTriangle);
        System.out.printf("%.2f\n", areaSquare);
        System.out.printf("%.2f\n", perimeterSquare);
    }
}
