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

int main() {
  int a, b, h, m;
  char buf[1500];
  while(fgets(buf,sizeof(buf),stdin) !=NULL) {
    sscanf(buf,"%d %d %d %d", &a, &b, &h,&m);
  }
  double x_a, y_a;
  double x_b, y_b;
  double x,y;
  x = 360-(360/720 * h * 60 - 90);
  x_a = a * cos(x);
  y_a = a * sin(x);

  if(h>=0 && h<= 3) {
  } else if(h>3 && h<=6){
    y_a = -y_a;
  } else if(h>6 && h<= 9){
    x_a = -x_a;
    y_a = -y_a;
  } else if(h>9 && h<12) {
    x_a = -x_a;
  }
  y = 360-(360/60 * m * 60-90);
  x_b = b * cos(y);
  y_b = b * sin(y);
  if(h>=0 && h<=15) {
  } else if(h>15 && h<=30){
    y_b = -y_b;
  } else if(h>30 && h<=45) {
    x_b = -x_b;
    y_b = -y_b;
  } else {
    x_b = -x_b;
  }
printf("%lf %lf %lf %lf", x_a,y_a,x_b,y_b);
  double x1;
  x1 = sqrt((x_a-x_b) * (x_a-x_b) + (y_a-y_b)*(y_a-y_b));
  printf("%lf\n", x1);
  return 0;
}
