import java.util.Scanner;

public class Main {

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);

        int A = sc.nextInt();
        int B = sc.nextInt();
        int H = sc.nextInt();
        int M = sc.nextInt();
        double hAngle = 30 * H;
        double mAngle = 6 * M;

        hAngle += 30 * (mAngle / 360);
        
        double angle = Math.abs(hAngle - mAngle);
        double rad = Math.toRadians(angle);
        double cos = Math.cos(rad);
        double x = Math.pow(A,2) + Math.pow(B,2) - 2*A*B *cos;

        System.out.println(Math.sqrt(x));
    }
} import java.util.Scanner; Scanner java.util public class Main {

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);

        int A = sc.nextInt();
        int B = sc.nextInt();
        int H = sc.nextInt();
        int M = sc.nextInt();
        double hAngle = 30 * H;
        double mAngle = 6 * M;

        hAngle += 30 * (mAngle / 360);
        
        double angle = Math.abs(hAngle - mAngle);
        double rad = Math.toRadians(angle);
        double cos = Math.cos(rad);
        double x = Math.pow(A,2) + Math.pow(B,2) - 2*A*B *cos;

        System.out.println(Math.sqrt(x));
    }
} Main public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);

        int A = sc.nextInt();
        int B = sc.nextInt();
        int H = sc.nextInt();
        int M = sc.nextInt();
        double hAngle = 30 * H;
        double mAngle = 6 * M;

        hAngle += 30 * (mAngle / 360);
        
        double angle = Math.abs(hAngle - mAngle);
        double rad = Math.toRadians(angle);
        double cos = Math.cos(rad);
        double x = Math.pow(A,2) + Math.pow(B,2) - 2*A*B *cos;

        System.out.println(Math.sqrt(x));
    } main {

        Scanner sc = new Scanner(System.in);

        int A = sc.nextInt();
        int B = sc.nextInt();
        int H = sc.nextInt();
        int M = sc.nextInt();
        double hAngle = 30 * H;
        double mAngle = 6 * M;

        hAngle += 30 * (mAngle / 360);
        
        double angle = Math.abs(hAngle - mAngle);
        double rad = Math.toRadians(angle);
        double cos = Math.cos(rad);
        double x = Math.pow(A,2) + Math.pow(B,2) - 2*A*B *cos;

        System.out.println(Math.sqrt(x));
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int A = sc.nextInt(); A sc.nextInt() sc.nextInt sc int B = sc.nextInt(); B sc.nextInt() sc.nextInt sc int H = sc.nextInt(); H sc.nextInt() sc.nextInt sc int M = sc.nextInt(); M sc.nextInt() sc.nextInt sc double hAngle = 30 * H; hAngle 30 * H 30 H double mAngle = 6 * M; mAngle 6 * M 6 M hAngle += 30 * (mAngle / 360) hAngle 30 * (mAngle / 360) 30 (mAngle / 360) mAngle 360 double angle = Math.abs(hAngle - mAngle); angle Math.abs(hAngle - mAngle) Math.abs Math hAngle - mAngle hAngle mAngle double rad = Math.toRadians(angle); rad Math.toRadians(angle) Math.toRadians Math angle double cos = Math.cos(rad); cos Math.cos(rad) Math.cos Math rad double x = Math.pow(A,2) + Math.pow(B,2) - 2*A*B *cos; x Math.pow(A,2) + Math.pow(B,2) - 2*A*B *cos Math.pow(A,2) + Math.pow(B,2) Math.pow(A,2) Math.pow Math A 2 Math.pow(B,2) Math.pow Math B 2 2*A*B *cos B 2*A*B *cos 2 A B cos System.out.println(Math.sqrt(x)) System.out.println System.out System System.out Math.sqrt(x) Math.sqrt Math x String[] args args public class Main {

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);

        int A = sc.nextInt();
        int B = sc.nextInt();
        int H = sc.nextInt();
        int M = sc.nextInt();
        double hAngle = 30 * H;
        double mAngle = 6 * M;

        hAngle += 30 * (mAngle / 360);
        
        double angle = Math.abs(hAngle - mAngle);
        double rad = Math.toRadians(angle);
        double cos = Math.cos(rad);
        double x = Math.pow(A,2) + Math.pow(B,2) - 2*A*B *cos;

        System.out.println(Math.sqrt(x));
    }
} public class Main {

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);

        int A = sc.nextInt();
        int B = sc.nextInt();
        int H = sc.nextInt();
        int M = sc.nextInt();
        double hAngle = 30 * H;
        double mAngle = 6 * M;

        hAngle += 30 * (mAngle / 360);
        
        double angle = Math.abs(hAngle - mAngle);
        double rad = Math.toRadians(angle);
        double cos = Math.cos(rad);
        double x = Math.pow(A,2) + Math.pow(B,2) - 2*A*B *cos;

        System.out.println(Math.sqrt(x));
    }
} Main
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);

        int A = sc.nextInt();
        int B = sc.nextInt();
        int H = sc.nextInt();
        int M = sc.nextInt();
        double hAngle = 30 * H;
        double mAngle = 6 * M;

        hAngle += 30 * (mAngle / 360);
        
        double angle = Math.abs(hAngle - mAngle);
        double rad = Math.toRadians(angle);
        double cos = Math.cos(rad);
        double x = Math.pow(A,2) + Math.pow(B,2) - 2*A*B *cos;

        System.out.println(Math.sqrt(x));
    }
}