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

int main(void) {
	int A, B, H, M;
	double theta_zi, theta_fun;
	double pi = atan(1) * 4;
	double yukati;
	double zix, ziy, funx, funy;
	if (scanf("%d%d%d%d", &A, &B, &H, &M) != 4) return 1;
	yukati = H + M / 60.0;

	theta_zi = 2 * pi * yukati / 12;
	theta_fun = 2 * pi * yukati;

	zix = A * sin(theta_zi);
	ziy = A * cos(theta_zi);
	funx = B * sin(theta_fun);
	funy = B * cos(theta_fun);

	printf("%.15f\n", sqrt((zix - funx) * (zix - funx) + (ziy - funy) * (ziy - funy)));
	return 0;
}
