#include<math.h>
#include<stdio.h>
 
int main(){
  int a,b,h,m;
  double d,sitah,sitam,co;
  scanf("%d %d %d %d",&a,&b,&h,&m);
  sitah=30*h*2*M_PI/360;
  sitam=6*m*2*M_PI/360;
  printf("%lf %lf",sin(sitah),sin(sitam));
  co=cos(sitah)*cos(sitam)+sin(sitah)*sin(sitam);
  printf("%lf %lf %lf ",sitah,sitam,co);
  d=a*a+b*b-2*a*b*co;
  printf("%lf",sqrt(d));
}