#include <float.h>
#include <inttypes.h>
#include <limits.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <unistd.h>
#include <math.h>
#ifdef __cplusplus
#include <bits/stdc++.h>
#endif

uint32_t nextpint(void){ char c=getchar_unlocked(); while(c<'0'||'9'<c) c=getchar_unlocked(); uint32_t x=0; while('0'<=c && c<='9'){ x=x*10+c-'0'; c=getchar_unlocked(); } return x; }

int main(void){
	uint32_t a=nextpint();
	uint32_t b=nextpint();
	uint32_t h=nextpint();
	uint32_t m=nextpint();
	double sa = M_PI*2/12*h+M_PI*2/12/60*m;
	double sb = M_PI*2/60*m;
	double dx = a*sin(sa) - b*sin(sb);
	double dy = a*cos(sa) - b*cos(sb);
	double ans = hypot(dx, dy);
	printf("%.9lf\n", ans);
}
