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

#define PI 3.141592

int main()
{
	//変数宣言
	int A,B;
	int H,M;
	
	double SA,SB;
	
	double AX,AY,BX,BY;
	
	double ans;
	
	scanf("%d %d %d %d",&A,&B,&H,&M);
	
	SA = (double) (M + (60.0 * H)) / (12.0 * 60.0);
	SB = (double) M / 60.0;
	
	
	AX = (double)A * cos((double)SA*2.0*PI);
	AY = (double)A * sin((double)SA*2.0*PI);
	
	BX = (double)B * cos((double)SB*2.0*PI);
	BY = (double)B * sin((double)SB*2.0*PI);
	
	ans = sqrt(pow(AX-BX,2.0)+pow(AY-BY,2.0));
	
	printf("%lf\n",AX);
	printf("%lf\n",AY);
	printf("%lf\n",BX);
	printf("%lf\n",BY);
	printf("%lf\n",ans);
	printf("%lf\n",ans);
	printf("%lf\n",ans);
	
	return 0;
}