/* ex4_1
  sachiyan */

#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#define PAI 3.14159265

int main(void){
    int len_hour, len_minute, hour, minute;
    double degree, diff, radian, cosine, answer;
    scanf("%d %d %d %d", &len_hour, &len_minute, &hour, &minute);
    degree = (double)0.5*(60*hour + minute) - 6*minute;
    printf("%lf\n", degree);
    diff = abs(degree);
    printf("%lf\n", diff);

    if (diff <= 180){
        radian = diff*(PAI/180);
        double cosine = cos(radian);
        double answer = sqrt(len_hour*len_hour + len_minute*len_minute - 2*len_hour*len_minute*cosine);
        printf("%lf\n", answer);
    }
    else{
        radian = (360 - diff)*(PAI/180);
        double cosine =  cos(radian);
        double answer = sqrt(len_hour*len_hour + len_minute*len_minute - 2*len_hour*len_minute*cosine);
        printf("%lf\n", answer);
    }

    return 0;
}