#include <stdio.h>
#include <math.h>
#define PI 3.14

int main()
{
  double a,b,h,m;
  scanf("%lf",&a);
  scanf("%lf",&b);
  scanf("%lf",&h);
  scanf("%lf",&m);

  printf("%f\n",(double)sqrt(pow(a,2.0) + pow(b,2.0)-2*a*b*cos(2*PI/12*h-PI*m/30)));
  printf("%f\n",pow(a,2.0));
  printf("%f\n",pow(b,2.0));
  printf("%f\n",2*a*b*cos(2*PI/12*h-PI*m/30));
  return 0;
}
