/*  ex4_2 Colon
    pandacodeb  */

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

double findAng(double h, double m);
double findDist(double lenH, double lenM, double h, double m);

int main(void){
    double lenH, lenM, h, m;
    scanf("%lf %lf %lf %lf", &lenH, &lenM, &h, &m);
    printf("angle: %f, cos: %f\n", findAng(h, m), cos(findAng(h, m)));
    printf("%.10f\n", findDist(lenH, lenM, h, m));
    return 0;
}

double findAng(double h, double m){
    double angleH = (2 * M_PI * h/12) + (M_PI/6 * m/60);
    double angleM = 2 * M_PI * m/60;
    return angleM - angleH;
}

double findDist(double lenH, double lenM, double h, double m){
    double angle = findAng(h, m);
    double dist = sqrt(lenH*lenH + lenM*lenM - 2*lenH*lenM*cos(angle));
    return dist;
}