#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>
int main(void){
    // Your code here!
    int A,B,H,M;
    
    scanf("%d%d%d%d",&A,&B,&H,&M);
    
    long double kaku = 0.5*(60*H+M) - 6*M;
    long double rad = abs(kaku)/180.0*3.1415926535;
    
    printf("%16.9lf%lf",sqrt(A*A+B*B-2*A*B*cos(rad)),rad);
    
   
    return 0;
}
