#include<stdio.h>
#include<math.h>
int main(){
	double a,b;
	scanf("%lf %lf",&a,&b);
	double x,y;
	scanf("%lf %lf",&x,&y);
	x*=60;
	x+=y; 
	double m=0.5,n=6;
	printf("%f\n",x*m);
	double l=fabs(x*m-y*n);
	if(l>=180)l=fabs(y*n-x*m);
	l=cos(l*3.141592653589/180);
	double c=sqrt(a*a+b*b-2*a*b*l);
	printf("%.20lf",c); 
	return 0;
}