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

int main()
{
	int		a,b,h,m;

	double	ax,ay;
	double	bx,by;
	double  cx,cy;
	double  ab;
	double pai = 3.141592653589793238462643383279L;
	
	scanf("%d %d %d %d", &a, &b, &h, &m);

	ax = a *  sinl( (((2*pai) / 12) * h) + ((((2*pai) / 12) / 60) * m));
	ay = a * -cosl( (((2*pai) / 12) * h) + ((((2*pai) / 12) / 60) * m));

	bx = b * sinl(((2*pai) / 60) * m);
	by = b * -cosl(((2*pai) / 60) * m);
/*
	printf("%lf %lf\n", ax,ay);
	printf("%lf %lf\n", bx,by);
*/
	cx = fabs(ax - bx);
	cy = fabs(ay - by);
	ab = sqrt((cx*cx) + (cy*cy));

/*	printf("%lf %lf\n", cx,cy);*/
	printf("%22.20lf\n", ab);
/*
//5.00000000000000000000
//4.56425719433005567605
//4.56425719433005383507
*/
    return 0;
}
