peterverebics/CodeNet_Python_118 huggingface dataset:
import math
a, b, h, m = map(int, input().split())

C = 2 * math.pi * (60*h - 11*m) / 720
c = a**2 + b**2 - 2*a*b*math.cos(C)
print(math.sqrt(c))
import math
A, B, H, M = map(int, input().split())
K = H * 60 + M
L = K / 2 - M * 6
S = A**2 + B**2 - 2*A*B*math.cos(math.radians(L))
T = S**0.5
print(T)
A,B,H,M=map(int,input().split())

h=(H*60+M)/2
m=6*M
import math

pi=math.pi
theta=abs(h-m)*2*pi/360


ans=A**2+B**2-2*A*B*math.cos(theta)

print(ans**0.5)
A,B,h,M = list(map(int,input().split()))
#余弦定理よりL^2=A^2+B^2-2ABcosα 
import math
H = h + M/60 #M分だけ移動した時針　
cos = math.cos(math.radians(6*abs(5*H-M)))
print(math.sqrt(A ** 2 + B ** 2 - 2*A*B*cos))
import math

a,b,h,m = map(int,input().split())

c = (h * 60 * 0.5) + (m * 0.5)
d = m * 6

if c > d:
  e = c - d
else:
  e = d - c

ans = (a * a) + (b * b) - 2 * a * b * math.cos(math.radians(e))
print(math.sqrt(ans))
import numpy as np

a, b, h, m = map(int,input().split())

beta = 2*np.pi / 60 * float(m)
alpha = 2*np.pi / 12 * h + 2*np.pi /12 /60 * m
theta = abs(alpha - beta)

ans = np.sqrt((a - b*np.cos(theta))**2 + (b*np.sin(theta))**2)

print(ans)
import math
a,b,h,m = map(int,input().split())

ans = 0

m_r = m/5
# print(m_r)
h_r = h + m/60
# print(h_r)
# print((h_r - m_r)/12*360)
reg = (h_r - m_r)/12*360
ans = math.sqrt(a**2 + b**2 -2*a*b*math.cos(math.radians(reg)))

print(ans)
import math
a, b, h, m = map(int, input().split())

B = (math.pi)*m/30
A = (math.pi)*h/6 + B/12

print(((a**2) + (b**2) - 2*a*b*(math.cos(B-A)))**(1/2))
import math

A, B, H, M = map(int, input().split())

A_degree = (360 / (60 * 12)) * (H * 60 + M)
B_degree = (360 / 60) * M

A_x = A * math.cos(math.radians(A_degree))
A_y = A * math.sin(math.radians(A_degree))

B_x = B * math.cos(math.radians(B_degree))
B_y = B * math.sin(math.radians(B_degree))

ans = math.sqrt((A_x - B_x)**2 + (A_y - B_y)**2)

print(ans)
import math as ma

a,b,h,m = map(int,input().split())

al = 360 * (h + m /60) /12
bl = m*6
rad = ma.radians(min(abs(bl - al), 360 - abs(bl - al)))
r = ma.sqrt(a**2 + b**2 -2*a*b*ma.cos(rad))
print(r)
import math

def main():
  A, B, H, M = map(int, input().split())
  Ax = A * math.sin((H + M / 60) * 30 / 180 * math.pi)
  Ay = A * math.cos((H + M / 60) * 30 / 180 * math.pi)
  Bx = B * math.sin(M * 6 / 180 * math.pi)
  By = B * math.cos(M * 6 / 180 * math.pi)
  dist = math.sqrt((Ax - Bx) ** 2 + (Ay - By) ** 2)
  print(dist)

if __name__ == '__main__':
  main()
import math
a,b,h,m = map(int,input().split())

hr = h*30+m/2
mr = m*6
r = abs(hr-mr)
r = min(r, 360-r)

ans = a**2 + b**2 - 2*a*b*math.cos(math.radians(r))

print(math.sqrt(ans))
import io
import sys
import math

def solve():
    A, B, H, M = list(map(int, input().split()))
    C_sq = A**2 + B**2 - 2*A*B*math.cos((H - 11/60 * M)*math.pi/6)
    C = math.sqrt(C_sq)
    print(C) 


if __name__ == "__main__":
    solve()
import math
A, B, H, M = map(int, input().split())
pi = math.pi

angle = (M * pi)/360 + (H * pi)/6 - (M * pi)/30

X = A**2 + B**2 - 2 * A * B * math.cos(angle)

ans = math.sqrt(X)
print(ans)
A, B, H, M = map(int,input().split())

import numpy as np
theta_h=2*np.pi*(H/12 + M/720)#rad
theta_m=2*np.pi*M/60#rad
theta=min((max(theta_h, theta_m)-min(theta_h, theta_m)), 2*np.pi-(max(theta_h, theta_m)-min(theta_h, theta_m)))
print(np.sqrt(A**2 + B**2 - 2*np.cos(theta)*A*B))
import math

A, B, H, M = map(int, input().split())

h = math.pi*2/(12*60)
m = math.pi*2/60

angle_M = M * m
angle_H = (H * 60 + M) * h

angle = math.fabs(angle_M - angle_H)

length = math.sqrt(A * A + B * B - 2 * A * B * math.cos(angle))

print(length)
from math import pi, cos,  sqrt
A, B, H, M = map(int, input().split())
w_a = 2*pi/(12*60.0)
w_b = 2*pi/(60.0)
theta_a = w_a*(H*60+M)
theta_b = w_b*M
ans = sqrt(A**2+B**2-2*A*B*cos(theta_a-theta_b))
print("{:.20f}".format(ans))
import math
A,B,H,M = map(int,input().split())
t1 = (30*H+M/2)*math.pi/180
x1 = A*math.cos(t1)
y1 = A*math.sin(t1)
t2 = M*math.pi/30
x2 = B*math.cos(t2)
y2 = B*math.sin(t2)
d = ((x1-x2)**2+(y1-y2)**2)**0.5
print(d)
import math

a,b,h,m=map(int,input().split())


h=h*30+0.5*m
m*=6
x=min(abs(h-m),360-abs(h-m))
y=math.cos(math.radians(x))

if x==1:
    print(0)
else:
    print(math.sqrt(a**2+b**2-2*a*b*y))
import numpy as np
a, b, h, m = map(int, input().split())
h_deg = (h*60+m)/720
m_deg = m/60
deg = max(h_deg-m_deg, m_deg-h_deg)
deg = 1.0-deg if deg > 0.5 else deg
if deg == 0.5:
    print('{:.20f}'.format(a+b))
else:
    print('{:.20f}'.format(np.sqrt(a**2+b**2-(2*a*b*np.cos(2*np.pi*deg)))))
import math

A,B,H,M = map(int,input().split())

co_hour = [math.cos(((H*60 + M)/360 - 1/2) * math.pi) * A , math.sin(((H*60 + M)/360 - 1/2) * math.pi) * A]
co_min = [math.cos(((M/30 - 1/2) * math.pi)) * B, math.sin(((M/30 - 1/2) * math.pi)) * B]

x = co_hour[0] - co_min[0]
y = co_hour[1] - co_min[1]

Answer = math.sqrt(x * x + y * y)

print(Answer)
import math

A, B, H, M = map(int, input().split())
angleH = 360 * ((H + (M / 60)) / 12)
angleM = 360 * (M / 60)
angle = abs(angleH - angleM)
answer = math.sqrt(math.pow(A, 2) + math.pow(B, 2) - (2 * A * B * math.cos(math.radians(angle))))
print(answer)
import math
A, B, H, M = map(int, input().split(' '))
deg = abs(H * 30 + 0.5 * M - 6 * M)
if deg > 180:
    deg = 360 - deg
deg = math.radians(deg)
print(math.sqrt((B - A * math.cos(deg)) ** 2 + (A * math.sin(deg)) ** 2))
import math

a, b, h, m = map(int, input().split())

a_angle = h * 30 + m / 2
b_angle = m * 6
cos_x = math.cos(math.radians(a_angle-b_angle))
d = math.sqrt(a ** 2 + b ** 2 - 2 * a * b * cos_x)
print(d)
import math
def main():
  A,B,H,M = map(int, input().split())
  H_DO=(H*60+M)*360/(12*60)
  M_DO=M*6
  if(H_DO>M_DO):
    sabu=H_DO-M_DO
  elif(H_DO<M_DO):
    sabu=M_DO-H_DO
  else:
    sabu=0
  L=(A*A)+(B*B)-2*A*B*math.cos(math.radians(sabu))
  C=math.sqrt(L)
  print(C)
  
if __name__ == '__main__':
    main()
A,B,H,M = list(map(int,input().split()))

import math 

x = A**2+B**2-2*A*B*math.cos(math.radians(11*M/2-30*H))

print(math.sqrt(x))
import math
A, B, H, M = map(int, input().split())

rad_h = (H / 12  + M / 12 / 60 ) * 2 * math.pi
rad_m = M / 60 * 2 * math.pi

res = math.sqrt(A ** 2 + B ** 2 - 2 * A * B * math.cos(abs(rad_h - rad_m)))
print(res)
A,B,H,M=map(int,input().split())

import math  #三角関数・円周率
import numpy

H = H + M / 60
H_A = H / 12 * 360 * math.pi /180
M_A = M / 60 * 360 * math.pi / 180
H_x = math.cos(H_A) * A  #針の先端の座標計算（中心基準）
H_y = math.sin(H_A) * A
M_x = math.cos(M_A) * B
M_y = math.sin(M_A) * B

a = numpy.array([H_x, H_y])
b = numpy.array([M_x, M_y])
u = b - a
print(numpy.linalg.norm(u))
A, B, H, M = map(int, input().split())

import math

sita = min(abs(30*H-11*M/2), 360-abs(30*H-11*M/2))

# print(sita)

# print(math.cos(math.radians(sita)))

print((A**2 + B**2 - 2*A*B*math.cos(math.radians(sita)))**(1/2))
import math
A, B, H, M = map(float, input().split())

m_angle = 6.0 * M
h_angle = 30.0 * H + 0.5 * M

theta = abs(h_angle - m_angle)
theta = min(theta, 360.0 - theta)
print(math.sqrt(A * A + B * B - 2 * A * B * math.cos(math.radians(theta))))
import math
A, B, H, M = map(int, input().split())

wa = 360/12
wb = 360/1
t = H + M/60
theta = math.radians((wa*t)%360 - (wb*t)%360)
print(math.sqrt(A**2 + B**2 -2*A*B*math.cos(theta)))
import math

a,b,H,M=map(int,input().split())

theta_a = math.pi/6 * (H+M/60)
theta_b = math.pi*2*M/60

ans = math.sqrt((b*math.cos(theta_b) - a*math.cos(theta_a))**2 + (b*math.sin(theta_b) - a*math.sin(theta_a))**2)

print(ans)
import math

a,b,h,m = map(int,input().split())

hour_deg = (h + m / 60) / 12 * 360
min_deg = (m / 60) * 360

deg_diff = abs(min_deg - hour_deg)
ans = a**2 + b**2 - (2 * a * b * math.cos(math.radians(deg_diff)))
print(math.sqrt(ans))
import numpy as np

a,b,h,m=list(map(int,input().split()))

deg = min(abs(h*360/12+m*360/12/60-m*360/60),360-abs(h*360/12+m*360/12/60-m*360/60))
theta = deg * np.pi /180
ans = np.sqrt(np.power(a,2)+np.power(b,2)-2*a*b*np.cos(theta))

print(ans)
import math
if __name__=="__main__":
    # Problem c
    A, B, H, M = map(int, input().split(' '))

    total_min = H*60 + M
    A_rad = 2*math.pi/720 * total_min
    B_rad = 2*math.pi/60 * M
    angle = A_rad-B_rad
    length_pow = A**2 + B**2 - 2*A*B*math.cos(angle)
    print(length_pow**(1/2))
import math
A, B, H, M = map(int, input().split())
Hno = 30 * H + 0.5 * M
Mno = 6 * M
 
angle = Hno - Mno
if angle < 0:
    angle *= -1
 
cos = math.cos(math.radians(angle))
x = A ** 2 + B ** 2 - (2 * A * B * cos)
print(math.sqrt(x))
A, B, H, M = input().split(" ")
A, B, H, M = int(A), int(B), int(H), int(M)

import math

dig = min(abs((H * 60 + M) * 0.5 - M*6), 360 - abs((H * 60 + M) * 0.5 - M*6))
if dig <= 90:
    a2 = A * math.cos((dig/180) * math.pi)
    a3 = A * math.sin((dig/180) * math.pi)
    print(((B-a2)**2 + a3**2)**(1/2))

elif dig > 90:
    dig1 = 180 - dig
    a2 = A * math.sin((dig1/180) * math.pi)
    a3 = A * math.cos((dig1/180) * math.pi)
    print(((B+a3)**2 + a2**2)**(1/2))
import math 

A, B, H, M = map(int, input().split())

m_deg = 360/60*M
#print(m_deg)

h_deg = 360/(12*60)*(H*60+M)
#print(h_deg)

a2 = A**2 + B**2 -2*A*B*math.cos(math.radians(abs(h_deg - m_deg)))
print(math.sqrt(a2))
import math
A, B, H, M = map(int, input().split())

A_ang = (60*H+M)*math.pi/ 360
B_ang = M*math.pi / 30

X_A = A*math.sin(A_ang)
Y_A = A*math.cos(A_ang)

X_B = B*math.sin(B_ang)
Y_B = B*math.cos(B_ang)

X_D = X_A - X_B
Y_D = Y_A - Y_B

ans = math.sqrt(X_D*X_D + Y_D*Y_D)

print(ans)
import math
a,b,h,m = map(int, input().split())

do = 360*((h+m/60)/12 - m/60)
do = min(do, 360-do)
print((a**2 + b**2 - 2*a*b*math.cos(math.radians(do)))**(0.5))
import math
a,b,h,m, = map(int,input().split())
al = 360*(60*h+m)/720
be = 360*m/60
x = (a**2 + b**2 - 2*a*b*math.cos(math.radians(al-be)))**(0.5)
print(x)
import math
A,B,H,M = map(int,input().split( ))
pi = 2*math.pi
time = H*60. + M
theta_A = (time/720.)*pi
theta_B = (M/60.)*pi
theta = abs(theta_A - theta_B)
if theta >= 180:
    theta = pi - theta
C = A**2 + B**2 - 2*A*B*math.cos(theta)
print(math.sqrt(C))
import math
A, B, H, M = map(int, input().split())

a = (H / 6 + M / 360) * math.pi
ax = math.cos(a) * A
ay = math.sin(a) * A

b = M / 30 * math.pi
bx = math.cos(b) * B 
by = math.sin(b) * B

print(math.sqrt((ax - bx)**2 + (ay - by)**2))
import sys
input = sys.stdin.readline
import math
a, b, h, m = map(int,input().split())
c = ((h%12) * 60 + m) / (60 * 12)
d = m / 60
t = abs(c-d) * 2 * math.pi
# print(t)
print((a**2 + b**2 - 2*a*b*math.cos(t)) ** 0.5)
# -*- coding: utf-8 -*-
import math

a, b, h, m = (int(x) for x in input().split())

if h == 0: #1時まで
    angle = math.radians(5.5*m)
else:
    angle = math.radians(h*30-5.5*m)

x = math.sqrt(a**2+b**2-2*a*b*math.cos(angle))

print(x)
import math
a,b,h,m=map(int,input().split())
ang=6*m-30*h-m/2
if ang<0:
    ang*=-1
ang=ang*math.pi/180
#c=math.cos(ang)
#print(c)
r=math.sqrt(a*a+b*b-2*a*b*math.cos(ang))
print(r)
from math import sqrt, cos
a, b, h, m = map(int, input().split())

pi = 3.141592653589793238
tmp = abs(m*6-(h*30+m/2))
arg = min(tmp, 360-tmp)

print(sqrt(a**2+b**2-2*a*b*cos(arg*pi/180)))
import numpy as np
A, B, H, M = list(map(int, input().split()))
print(np.sqrt(A**2+B**2-2*A*B*np.cos(np.deg2rad(abs(360*((H+M/60)/12-M/60))))))
import numpy as np
import math
A,B,H,M = input().split()
A = int(A)
B = int(B)
H = int(H)
M = int(M)

angle = abs(30* H - 5.5 * M)
if angle > 180:
  angle = 360 - angle

ans = np.sqrt((A**2 + B**2) - (2 * A * B * np.cos(np.radians(angle))))
print(ans)
from math import*

A,B,H,M = map(int, input().split())

print((A*A+B*B-2*A*B*cos((M*11/360-H/6)*pi))**.5)
import math
A, B, H, M = map(int, input().split())

h = H % 12
m = M % 60

rh = (h/12+M/60*1/12)*2*math.pi
rm = (m/60)*2*math.pi
r = min(rh - rm, 2*math.pi - (rh - rm))

c = A**2 + B**2 - 2*A*B*math.cos(r)
print(math.sqrt(c))
import math

a, b, h, m = map(int, input().split())
h=h*60+m

ang=abs(h*0.5-m*6)
if ang > 180:
  ang = 360-ang
if ang==180:
  print(a+b)
elif(ang==0):
  print(abs(b-a))
else:
  ans=(a**2)+(b**2)-(2*a*b*math.cos(math.radians(ang)))
  print(math.sqrt(ans))
import math
A,B,H,M = map(int,input().split(" "))

a_angle = 360*H/12 + 15*2*M/60
b_angle = 360*M/60

angle = a_angle - b_angle
if angle>180:
    angle = 360 - angle

ans = A**2 + B**2 - 2*A*B*math.cos(math.radians(angle))
print(ans**0.5)
import math
a,b,h,m= map(int, input().split())

hr = 30*h+0.5*m
mr = 6*m
ans = a**2+b**2-2*a*b*math.cos(math.radians(hr-mr))
print(math.sqrt(ans))
import math as mt
a,b,h,m=map(int, input().split())
print(mt.sqrt(a**2+b**2-2*a*b*mt.cos(2*mt.pi*(1/12*(h+m/60)-m/60))))
import math
A,B,H,M=map(int,input().split())

kaku=abs(30*H-5.5*M)
rad=math.radians(kaku)
#print(rad)

sq=A**2+B**2-2*A*B*math.cos(rad)
print(math.sqrt(sq))
import math
A,B,H,M = map(int,input().split())
zisin = 360/12 * H + 30/60 * M
hunsin = 360/60 * M 
kakusa = min(abs(zisin - hunsin),abs(360-zisin+hunsin))*math.pi/180
ans_2 = A**2 + B**2 - 2*A*B*math.cos(kakusa)
print(ans_2**0.5)
import math

a,b,h,m = map(int,input().split())

rad_a = (h/12+ (1/12) * (m/60))*360
rad_b = (m/60)*360

if rad_a == rad_b:
    print(abs(b-a))
elif abs(rad_a - rad_b) == 180:
    print(b+a)
else:
    print(math.sqrt(a**2 + b**2 - 2*a*b*math.cos(math.radians(abs(rad_a-rad_b)))))
import math
a,b,h,m = map(int,input().split())
s = 3600*h+60*m
r = 2*math.pi*s*(1/43200-1/3600)
print(math.sqrt(a**2 + b**2 - 2*a*b*math.cos(r)))
import numpy as np

a, b, h, m = [float(i) for i in input().split()]
kakua = 2*np.pi/12*h+2*np.pi/12*m/60
kakub = 2*np.pi/60*m
kaku = abs( kakua - kakub )
x = np.sqrt(a*a + b*b - 2*a*b*np.cos(kaku))
print(x)
import sys
import math

a, b, h, m = map(int, input().split())
h = (h+m/60)/12*2*math.pi
m = m/60*2*math.pi
p1 = [a*math.cos(h), a*math.sin(h)]
p2 = [b*math.cos(m), b*math.sin(m)]
print(((p1[0]-p2[0])**2+(p1[1]-p2[1])**2)**0.5)
import collections
from collections import defaultdict
import math
import numpy as np
import re
import itertools
import bisect

a,b,h,m=map(int, input().split())

l = 6*m
s = 0.5*m+30*h

kakudo = min(abs(l-s),360-abs(l-s))
print(math.sqrt(a*a+b*b-2*b*a*math.cos(math.radians(kakudo))))
[A,B,H,M] = list(map(int,input().split()))

X = (H+M*1/60)*30
Y = M*6
Z = min(abs(X-Y),abs(X+360-Y),abs(Y+360-X))
import math
cos = math.cos(math.radians(Z))
print((A**2+B**2-2*A*B*cos)**0.5)
import math

A,B,H,M = map(int, input().split())

h = ((60*H+M)*0.5)%360
m = (6*M)%360

theta = abs(h-m)
len = math.sqrt(A*A+B*B-2*A*B*math.cos(math.radians(theta)))
print(len)
from sys import stdin
from math import cos, radians, sqrt

a,b,h,m = [int(x) for x in stdin.readline().strip().split()]
thete_t = 360*h/12+30*m/60
thete_m = 360*m/60
diff_thete = max(thete_t, thete_m)-min(thete_t, thete_m)
thete = diff_thete if diff_thete < 180 else 360 - diff_thete
c2 = a**2 + b**2 - 2*a*b*cos(radians(thete))

print(sqrt(c2))
import math
a, b, h, m = map(float, input().split())
mm = (m % 60.0) * 6.0
hh = h * 30.0 + m * 0.5

rad = (mm - hh) * math.pi / 180.0
c = math.sqrt(math.pow(a, 2) + math.pow(b, 2) - 2 * a * b * math.cos(rad))

print(c)
import numpy

if __name__ == "__main__":
	hour_len, min_len, hours, minutes = map(int, input().strip().split(' '))
	angle_minute = 2 * numpy.pi * (minutes / 60)
	angle_hour = 2 * numpy.pi * (((hours * 60) + minutes) / 720)
	if angle_hour >= angle_minute:
		final_angle = angle_hour - angle_minute
	elif angle_minute > angle_hour:
		final_angle = angle_minute - angle_hour
	answer = (hour_len * hour_len) + (min_len * min_len) - (2 * min_len * hour_len * numpy.cos(final_angle))
	print(numpy.sqrt(answer))
import math
a,b,h,m = map(float, input().split())
rot = 5.5 * (60.0*h + m)
ang = rot%360
rad = ang * math.pi / 180
cal = a ** 2 + b ** 2 - 2 * a * b * math.cos(rad)
ans = math.sqrt(cal)
print(ans)
A,B,H,M=(int(x) for x in input().split())

import math

time = H*60 + M
dist = (5.5 * time)%360
if 0 < dist < 180:
   dist = 360 - dist

ans = math.sqrt(A*A + B*B  - 2*A*B*math.cos(math.radians(dist)))

print(ans)
import sys
import numpy as np
import math
input=sys.stdin.readline


a,b,h,m=map(int,input().split())
t=60*h+m
hun=6*t%360
zi=0.5*t
deg=min(360-abs(zi-hun),abs(zi-hun))
ans=a**2+b**2-2*a*b*math.cos(math.radians(deg))
print(pow(ans,0.5))
import math as m
A,B,H,M=list(map(int,input().split()))
print(m.sqrt(A**2+B**2-2*A*B*m.cos(m.radians(30*H-11*M/2))))
import math
A,B,H,M=map(int,input().split())
A_sin=A*math.sin(2*math.pi*(60*H+M)/720)
A_cou=A*math.cos(2*math.pi*(60*H+M)/720)
B_sin=B*math.sin(2*math.pi*(M/60))
B_cos=B*math.cos(2*math.pi*(M/60))
ans=math.sqrt((A_sin-B_sin)**2+(A_cou-B_cos)**2)
print(ans)
import numpy as np
a, b, h, m = map(int, input().split())
h_a = ((h % 12) + m / 60)*360 / 12
m_b = ((m % 60)*360/60)%360
angle = min(np.abs(h_a - m_b), 360 - np.abs(h_a - m_b))
print(np.sqrt(a**2 + b**2 - 2*a*b*np.cos(np.radians(angle))))
import math
A,B,H,M=map(int,input().split())

theta_hour=math.pi/6*H+math.pi/6*M/60
theta_minute=math.pi/30*M
x=A**2+B**2-2*A*B*math.cos(abs(theta_hour-theta_minute))

print(math.sqrt(x))
import math

a,b,h,m = map(int,input().split())

s=abs(h*30+m*0.5-m*6)

d=min(s,360-s)

c=a*a+b*b-2*a*b*math.cos(math.radians(d))

print(math.sqrt(c))
from sys import stdin
from math import sin,cos,pi
def main():
    #入力
    readline=stdin.readline
    A,B,H,M=map(int,readline().split())

    s=M*pi/30
    t=(H/6)*pi+(M/360)*pi
    x_A=A*sin(t)
    y_A=A*cos(t)

    x_B=B*sin(s)
    y_B=B*cos(s)

    print(((x_A-x_B)**2+(y_A-y_B)**2)**0.5)
    
if __name__=="__main__":
    main()
import numpy as np
A, B, H, M = map(int,input().split())
time = 60*H + M #経過時間(分)

rad_h = 2*np.pi-(np.pi/360)*time
rad_m = 2*np.pi-(np.pi/30)*M

A_x = A*np.cos(rad_h)
A_y = A*np.sin(rad_h)
B_x = B*np.cos(rad_m)
B_y = B*np.sin(rad_m)

v = np.array([A_x-B_x,A_y-B_y])

l = np.linalg.norm(v)
  
print(l)
import math
p=math.pi
a,b,h,m=map(int,input().split())
j=(b*math.cos(p*m/30),b*math.sin(p*m/30))
t=(a*math.cos((h/6+m/360)*p),a*math.sin((h/6+m/360)*p))
print(((j[0]-t[0])**2+(j[1]-t[1])**2)**(0.5))
import math
a,b,h,m=map(int,input().split())
angle=abs(m*6-(h*30+m/60*30))
print(math.sqrt(a*a+b*b-2*a*b*math.cos(angle/180*math.pi)))
import math
def findAngle(h,m):
	hour=(h*360)/12+(m*360)/(12*60)
	mint=(m*360)/60
	angle=abs(hour-mint)
	if(angle>180):
		angle=360-angle
	return angle
def dist(a,b,h,m):
  x=a**2+b**2-2*a*b*math.cos(math.radians(findAngle(h,m)))
  return x**0.5
a,b,h,m=map(int,input().split())
print(dist(a,b,h,m))
import sys
sys.setrecursionlimit(10000000)
import numpy as np
from heapq import heapify, heappop, heappush
import copy
import math


def main():
    A, B, H, M = map(int, input().split())
    theta = abs(6 * M - 30 * (H + M / 60))
    c = (B ** 2 + A ** 2 - 2 * A * B * math.cos(math.radians(theta))) ** 0.5
    print(c)

if __name__ == '__main__':
    main()
import math

A = list(map(int, input().split()))


D =A[0]**2+A[1]**2-2*A[0]*A[1]*math.cos(math.radians(30*A[2]-5.5*A[3]))

print(math.sqrt(D))
import math

a, b, h, m = map(int, input().split())
st = (60*h+m)/360*math.pi
lt = m/30*math.pi
sx = a*math.sin(st)
sy = a*math.cos(st)
lx = b*math.sin(lt)
ly = b*math.cos(lt)
print(math.sqrt((lx-sx)**2+(ly-sy)**2))
import math

def get_distance(x1, y1, x2, y2):
    d = math.sqrt((x2 - x1) ** 2 + (y2 - y1) ** 2)
    return d

a, b, h, m = list(map(int, input().split()))

point_h = [
    a * math.cos(math.radians((90 - 30*h)-m/2.0)),
    a * math.sin(math.radians((90 - 30*h)-m/2.0))
]

point_m = [
    b * math.cos(math.radians(90 - 6*m)),
    b * math.sin(math.radians(90 - 6*m))
]

print(get_distance(point_h[0], point_h[1], point_m[0], point_m[1]))
import math

A, B, H, M = map(int, input().split())

KA = H / 12 * 360 + ((M / 60) * (360 / 12))
KB = M / 60 * 360

K = abs(KA - KB)
if K > 180:
    K = 360 - K
# if K == 180:
#     print(A + B)
#     exit()
# if K == 0:
#     print(abs(B - A))
#     exit()
cosB = round(math.cos(math.radians(K)), 13)
cc = A ** 2 + B ** 2 - (2 * B * A * cosB)
print(math.sqrt(cc))
def main():
    a, b, h, m = map(int, input().split())

    from math import sin, cos, pi, sqrt

    ar = pi/2 - 2*pi/12*h - 2*pi/60/12*m
    br = pi/2 - 2*pi/60*m

    ax, ay = a * cos(ar), a * sin(ar)
    bx, by = b * cos(br), b * sin(br)

    c = sqrt((ax-bx)**2+(ay-by)**2)

    print(c)


if __name__ == "__main__":
    main()
import math
a, b, h, m = map(int, input().split())
H = 30 * h + 0.5 * m
M = 6 * m
angle = abs(H - M)

ans = a**2 + b**2 - (2 * a * b * math.cos(math.radians(angle)))
print(math.sqrt(ans))
import math


length_hour, length_min, hour, minute = map(int, input().split(' '))
total_min = hour * 60 + minute

hx = math.sin((total_min / (12 * 60)) * (2 * math.pi)) * length_hour
hy = math.cos((total_min / (12 * 60)) * (2 * math.pi)) * length_hour
mx = math.sin((minute / 60) * (2 * math.pi)) * length_min
my = math.cos((minute / 60) * (2 * math.pi)) * length_min

distance = math.sqrt((hx - mx) ** 2 + (hy - my) ** 2)

print(f"{distance}")
import math
A,B,h,m=map(int,input().split())
time=60*h+m
a=(0.5*time)%360
b=(6*time)%360
x=abs(a-b)
if x==0 or x==360:
  c=abs(A-B)
elif x==180:
  c=A+B
else:
  c=math.sqrt(A**2+B**2-2*A*B*math.cos(math.radians(x)))
print(c)
import math
A, B, H, M = [int(x) for x in input().split()]
h = 360 * (H + M/60) / 12
m = 360 * M / 60
cos = math.cos(math.radians(abs(h-m)))
ans = math.sqrt(A*A + B*B - 2*A*B*cos)
print(ans)
import math
a, b, h, m = map(int, input().split())
x = 360*(h/12)+30*(m/60)
y = 360*(m/60)
d = math.cos(math.radians(abs(x-y)))
z = a**2 + b**2 -2*a*b*d
print (math.sqrt(z))
import math

a,b,h,m = map(int,input().split())

m_ang = m*math.pi/30
h_ang = (h*30+m/2)*math.pi/180
ang = m_ang - h_ang
c = math.sqrt(a*a+b*b-2*a*b*math.cos(ang))

print(c)
import math
[A, B, H, M] = list(map(int, input().split()))
a = 2 * math.pi / 12 * (H + M / 60)
b = 2 * math.pi / 60 * M
c = a - b
answer = math.sqrt(A**2 + B**2 - 2*A*B*math.cos(c))
print(answer)
import math
def main():
	A, B, H, M = map(float, input().split())
	R = H/12 + M*0.5/360
	r = M/60
	cos = math.cos((R-r)*2*math.pi)
	C = math.sqrt(A*A + B*B - 2*A*B*cos)
	print(C)

if __name__ == '__main__':
	main()
import math
# A, B, H, M = 3, 4, 9, 0
A, B, H, M = map(int, input().split())

deg = 0
deg += 5.5 * M
deg -= 30 * H

print(math.sqrt(A**2 + B**2 - 2*A*B* math.cos(math.radians(abs(deg)))))
import math
a,b,H,M=map(int,input().split())
theta=abs(30*H+0.5*M-6*M)*math.pi/180
ans=math.sqrt(a**2+b**2-2*a*b*math.cos(theta))
print(ans)
import math
a, b, h, m = map(int, input().split())

m_a = m * 6
h_a = h * 30
if m > 0:
    h_a = h_a + m * 0.5
print(math.sqrt(a ** 2 + b ** 2 - (2 * a * b * math.cos(math.radians(max(m_a, h_a) - min(m_a, h_a))))))
import math
all = input()
A = int(all.split(' ')[0])
B = int(all.split(' ')[1])
H = int(all.split(' ')[2])
M = int(all.split(' ')[3])
delta_ = H/12+(1/12)*(M/60)-M/60
c = (A**2+B**2-2*A*B*math.cos(2*delta_*math.pi))**0.5
print(c)
# coding: utf-8
# Your code here!
import math

tanshin,choshin,jikan,hun=map(int,input().split(" "))

x1=tanshin*math.cos(math.radians(-(jikan*30+hun*0.5-90)))
y1=tanshin*math.sin(math.radians(-(jikan*30+hun*0.5-90)))
x2=choshin*math.cos(math.radians(-(hun*6-90)))
y2=choshin*math.sin(math.radians(-(hun*6-90)))
ans=math.sqrt((x2-x1)*(x2-x1)+(y2-y1)*(y2-y1))
print(ans)
# -*- coding: utf-8 -*-
"""
Created on Sun May 17 20:23:09 2020

@author: Kanaru Sato
"""
import math

a,b,h,m = list(map(int,input().split()))

s = a**2+b**2-2*a*b*math.cos(math.pi*(11*m-60*h)/360)
ans = math.sqrt(s)

print(ans)
import math
A,B,H,M = map(int,input().split())
kakudoA = (H+M/60)*30
kakudoB = M*6
kakudo = min(abs(kakudoA-kakudoB),360-abs(kakudoA-kakudoB))
henn2 = A**2+B**2-2*A*B*math.cos(math.radians(kakudo))
print(henn2**0.5)
import math
A,B,H,M = map(int,input().split())

H %= 12
ra = 0.5*(60*H+M)-6*M
ra = min(ra,360-ra)
cos_ra = math.radians(ra)
C = math.sqrt((A**2+B**2)-(2*A*B*math.cos(cos_ra)))
print(C)
import math
a,b,h,m=map(int,input().split())
ji=(h*60+m)/360

hun=m/30
use=math.pi*(ji-hun)
ans=(a**2+b**2-2*a*b*math.cos(use))**0.5
print(ans)
import math as m
A,B,H,M = map(int,input().split())
hour_angle =(30*H+0.5*M)
minute_angle =(6*M)
hour_X = float('{:.12f}'.format(m.sin(m.radians(hour_angle))))*A
hour_Y = float('{:.12f}'.format(m.cos(m.radians(hour_angle))))*A
minute_X = float('{:.12f}'.format(m.sin(m.radians(minute_angle))))*B
minute_Y = float('{:.12f}'.format(m.cos(m.radians(minute_angle))))*B
#print(hour_X,hour_Y,minute_X,minute_Y)
print(m.sqrt((hour_X-minute_X)**2+(hour_Y-minute_Y)**2))