/* ex4_2
   shu_t */

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

int main(void){
  int hour, minute;
  double hour_hand,minute_hand;
  double arg,ans,squared_ans;
  //input length of hour_hand and minute_hand
  //input hour and minute
  scanf("%lf %lf %d %d",&hour_hand,&minute_hand,&hour,&minute);
  //calculate argument ((60*H+M)/720-M/60)*2π
  arg = (60*hour-11*minute)*M_PI/360;
  //calculate squared_ans
  squared_ans = pow(hour_hand,2)+pow(minute_hand,2)-2*hour_hand*minute_hand*cos(arg);
  //calcurate square root
  ans = sqrt(squared_ans);
  //output the answer
  printf("%.10lf\n",ans);
  return 0;
}
