#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <math.h>


int main()
{
  int a, b, h, m;
  scanf("%d", &a);
  scanf("%d", &b);
  scanf("%d", &h);
  scanf("%d", &m);
  double hk = h*30+m*0.5;
  int mk = m*6;
  double rad = (hk - mk)*M_PI/180;
  double da = a*a;
  double db = b*b;
  printf("%.20lf\n", da);
  printf("%.20lf\n", da);
  // long long int x = a*a+b*b-2*a*b*cos(rad)*10000000000;
  // double l = sqrt(x)/100000.0;
  double l = sqrt(a*a+b*b-2*a*b*cos(rad));
  printf("%.20lf\n", l);
  // printf("Hello World!\n");
  return 0;
}