#include <stdio.h>
#include <math.h>

#ifndef M_PI
#define M_PI 3.14159265358979
#endif
#define deg_to_rad(deg) (((deg)/360)*2*M_PI)

int main(void) {
    int A, B, H, M;
    int mn;
    float Ax, Ay, Bx, By;
    float D;

    scanf("%d %d %d %d", &A, &B, &H, &M);

    mn = (H * 60) + M;
    printf("%d\n", mn);

    Ax = A * cos(deg_to_rad(mn / 720.0 * 360));
    Ay = A * sin(deg_to_rad(mn / 720.0 * 360));
    Bx = B * cos(deg_to_rad(M / 60.0 * 360));
    By = B * sin(deg_to_rad(M / 60.0 * 360));

    printf("Ax : %f\n", Ax);
    printf("Ay : %f\n", Ay);
    printf("Bx : %f\n", Bx);
    printf("By : %f\n", By);

    D = sqrt(pow((Ax - Bx), 2) + pow((Ay - By), 2));

    printf("%f\n", D);

    return 0;
}
