#include<stdio.h>
#include <math.h>
void main(void)
{
  double a,b,h,m;
  double rad;
  long  double ressult;
  scanf("%lf %lf %lf %lf",&a,&b,&h,&m);
  rad=(h*30.0+(m/2)-m*6.0);
  printf("%lf\n",rad);
  rad*=(M_PI/180.0);
  ressult=a*a+b*b-2*a*b*cos(rad);
  printf("%.20lf\n",sqrt(ressult));
}
