peterverebics/CodeNet_Python_118 huggingface dataset:
import math

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

dh = ((((60 * H) + M) / 720) * 360 - 90) * -1
dm = ((6 * M) - 90) * -1
h = math.radians(dh)
m = math.radians(dm)

ans = ((A * math.sin(h) - B * math.sin(m)) ** 2 + (A * math.cos(h) - B * math.cos(m)) ** 2) ** 0.5

print(ans)
from math import*
a,b,h,m=map(int,input().split())
print(sqrt(a*a+b*b-2*a*b*cos(radians(h*330+m*5.5))))
import sys
input = sys.stdin.readline


def main():
    A, B, H, M = map(int, input().split())
    import math
    rb = math.pi * 2 * 6*M / 360
    ra = math.pi * 2 * (30*H + 0.5*M) / 360
    ans = math.sqrt(A**2 + B**2 - 2*A*B*math.cos(ra-rb))
    print(ans)


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

a, b, h, m = map(int, input().split())
ang_a = (360 * h / 12) + (0.5 * m)
ang_b = 360 * m / 60
ang = abs(ang_a - ang_b)

ans = math.sqrt((a ** 2 + b ** 2) - (2*a*b*math.cos(math.radians(ang))))
print(ans)
import math
A,B,H,M=map(int,input().split())
print((A*A+B*B-2*A*B*math.cos(math.radians(abs(30*H-5.5*M))))**.5)
A,B,H,M=map(int,input().split())
import numpy as np
X=(H/12+M/(12*60)-M/60)*2*np.pi
if X<=np.pi:
  Y=X
else:
  Y=2*np.pi-X
print(np.sqrt((A-B*np.cos(Y))**2+(B*np.sin(Y))**2))
import math

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

hour_r = (0.5*H*60) + M*0.5

minu_r = 6*M

if hour_r > minu_r:
    k = hour_r - minu_r
else:
    k = minu_r - hour_r
k = min (k,360-k)
#print(k)

ans_2 = (A**2+B**2)-2*A*B*(math.cos(math.radians(k)))
print(ans_2**0.5)
import math
A,B,H,M = map(int,input().split())

r=2*math.pi*abs(H/12+M/60/12-M/60)
a=A**2+B**2-2*A*B*math.cos(r)
a=math.sqrt(a)
print(a)
import math

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

t = H * 60 + M

xh = A * math.sin(t % 720 / 720 * 2 * math.pi)
yh = A * math.cos(t % 720 / 720 * 2 * math.pi)
xm = B * math.sin(t % 60 / 60 * 2 * math.pi)
ym = B * math.cos(t % 60 / 60 * 2 * math.pi)

print(math.dist((xh, yh), (xm, ym)))
import math
[a, b, h, m] = list(map(int, input().rstrip().split()))
hour_angle = 0.5 * (h * 60 + m)
minute_angle = 6 * m

angle = abs(hour_angle - minute_angle)
angle = min([360 - angle, angle])
angle = angle * math.pi / 180

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

t = 60 * h + m
hr = t / 2
mr = m * 6

r = math.radians(abs(hr - mr))
c = a * a + b * b - 2 * a * b * math.cos(r)
print(math.sqrt(c))
import math
pi=3.1415926535897932
a,b,h,m=map(int,input().split())
ad=h*30+m*0.5
bd=m*6.0
x=min(abs(ad-bd),360.0-abs(ad-bd))
#if abs(x-180.0)<0.0000000001:
#    print(a+b)
#    exit()
ans=a**2+b**2-(2*a*b*math.cos(math.radians(x)))
print(ans**0.5)
from math import pi
from cmath import rect

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

thetaA = (H / 12) + (M / 60) * (1 / 12)
thetaB = (M / 60)

thetaA *= 2 * pi
thetaB *= 2 * pi

P = rect(A, thetaA)
Q = rect(B, thetaB)

print(abs(P - Q))
import math

a, b, h, m = map(int, input().split())
theta = 2*math.pi/12*(h + m / 60) - 2*math.pi/60*m
c = a*a + b*b - 2*a*b*math.cos(theta)
print(math.sqrt(c))
import math

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

radH = 360 * H / 12 + 30 * M / 60
radM = 360 * M / 60 

if radH > radM:
  rad = radH - radM
else:
  rad = radM - radH


cosC =  math.cos(math.radians(rad))

S = A*A + B*B - 2*A*B*cosC

print(math.sqrt(S))
import math

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

H_arg = H*30 + 0.5*M
M_arg = 6*M

if H_arg - M_arg>=180:
    H_M_arg = (360-H_arg) + M_arg
else:
    H_M_arg = abs(H_arg - M_arg)

# print(H_M_arg)

X = math.sqrt(A**2+B**2-2*A*B*math.cos(math.radians(H_M_arg)))
print(X)
import numpy as np
import math

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


def H_angle(H):
    return H * 30

def M_angle(M):
    return M * 6

angle = abs(H_angle(H) - M_angle(M))
if angle >= 180:
    angle = angle - 180
angle = math.radians(angle)

def compute(A, B, angle):
    A2 = np.square(A)
    B2 = np.square(B)
    AB = A * B
    cos = np.cos(angle)
    return A2 + B2 - 2 * AB * cos


print(np.sqrt(compute(A, B, angle)))
import math
a,b,h,m=map(int,input().split())

t=60*h+m

d=(t%60)*b
e=0.5*(h*60)

f=abs(d-e)

if f>=180:
    f=f-180

theta=math.radians(f)
print(math.sqrt(a**2 + b**2 - 2 * a * b * math.cos(theta)))
import math
A, B, H, M = list(map(int, input().split()))

h_deg = (90 - (360 / 12) * H) * (math.pi/180)
m_deg = (90 - (360 / 60) * M) * (math.pi/180)

h_x = A * math.cos(h_deg)
h_y = A * math.sin(h_deg)
m_x = B * math.cos(m_deg)
m_y = B * math.sin(m_deg)

print(math.sqrt((h_x - m_x)**2 + (h_y - m_y)**2))
import math
a,b,h,m=map(int,input().split())
h=(12-h)/12
m=(60-m)/60


ax=a*math.sin(2*math.pi*h)
ay=a*math.cos(2*math.pi*h)
bx=b*math.sin(2*math.pi*m)
by=b*math.cos(2*math.pi*m)



c=math.sqrt(abs(ax-bx)**2+abs(ay-by)**2)
print(c)
import math
A,B,H,M = map(int,input().split())

rad = H*30 - M * 6 if (H/12) > (M/60) else  M * 6 -H*30
print(((B**2) +( A **2 )- (2 * B * A )* (math.cos(math.radians(rad))))**0.5)
import math

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

a = int(A)
b = int(B)
h = int(H)
m = int(M)
ang = 6*m - (30*h + 0.5*m)

cosa =math.cos(ang)

c = math.sqrt(a**2 + b**2 - 2 * a * b * cosa)


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

rad_a = 360 * h / 12 + 30 * m / 60
rad_b = 360 * m / 60 

if rad_a == rad_b:
  print(float(0))
  
elif rad_a > rad_b:
  ans = a**2 + b **2 - 2*a*b*math.cos(math.radians(rad_a - rad_b))
  print(math.sqrt(ans))
else:
  ans = a**2 + b **2 - 2*a*b*math.cos(math.radians(rad_b - rad_a))
  print(math.sqrt(ans))
import math

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


x = abs(30 * h + 0.5 * m - m)

if x > 180:
    x = 360 - x

x = x  * math.pi / 180
ans = (a**2 + b**2 - 2 * a * b * math.cos(x))**0.5

print(ans)
import numpy as np
A, B, H, M = map(int, input().split())
a = (30 * (H + M / 60)) % 360
b = (360 * (H + M / 60)) % 360
r = abs(a - b)
deg = r if r < 180 else r - 180

l = 2 * np.sin((np.pi / 180 * deg)/2)
diff = abs(A - B)
ans = diff ** 2 + A * B * (l ** 2)
print(np.sqrt(ans))
a,b,h,m = map(int,input().split())
import math
h_pi = h * 0.0833333333* math.pi +m * (-math.pi*0.0069444444444)  + math.pi/4
m_pi = math.pi/2 - m*60*math.pi
if h_pi - m_pi <= math.pi :
    theta = h_pi - m_pi
else :
    theta = 2 * math.pi - (h_pi - m_pi)
ans = a**2 + b**2 -2 * a * b * math.cos(theta)
print(math.sqrt(ans))
print(h_pi)
import math

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

# print(A, B, H, M)

# 角度を求める.
angle_a = 30 * H + 0.5 * M

angle_b = M * 1.0

if angle_a == angle_b:
  angle = 0
elif angle_b > angle_a:
  angle = angle_b - angle_a
else:
  angle = angle_a - angle_b
# angle = abs(angle_a - amgle_b)

# print(angle)
  
# S = A * B * math.sin(math.radians(angle))

print(math.sqrt(A**2 + B**2 - 2*A*B*math.cos(math.radians(angle))))
import numpy as np
import sys
readline = sys.stdin.buffer.readline
a, b, h, m= list(map(int,readline().rstrip().split()))
th = (5*h-m)/30
if th > 1:
  th = 1-th
print(np.sqrt(float(a**2)+float(b**2)-2*a*b*np.cos(np.pi*th)))
import math
a, b, h, m= map(int, input().split())
x = abs(30 * h - 6 * m)
y = 360 - x
z = min(abs(30 * h - 6 * m), y)
c = a ** 2 + b ** 2 - 2 * a * b * math.cos(math.radians(z))
c = math.sqrt(c)
print(c)
import math

A, B, H, M = [int(i) for i in input().split(' ')]

A_theta = 360 / 12 * H
B_theta = 360 / 60 * M

theta = B_theta - A_theta

print(theta)
cos = math.cos(math.radians(theta))

print(cos)

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

print(dist)
import math
A,B,H,M = map(int, input().split())
sita = abs(0.5 * M - 30 * H)
ans = (A**2 + B**2 - 2 * A * B * math.cos(math.radians(sita)))** 0.5
print(ans)
import math
s,l,h,m=map(int,input().split())
#JIKOKU
t=60*h+m
#TANSHIN KAKUDO
sd=(0.5*t)%360
ld=(6*t)%360
x=abs(sd-ld)

if x==180:
    print(s+l)
    exit()
elif x==0:
    print(l-s)
elif x>180:
    x=x-180

radx=math.radians(x)
cosx=math.cos(radx)

print((s**2+l**2-2*l*s*cosx)**0.5)
a, b, h, m = map(int, input().split())

from math import sin, cos, sqrt, pi

jishin_rad = (h / 12 * 360) * pi / 180
funshin_rad = (m / 60 * 360) * pi / 180

jishin = (cos(jishin_rad)*a, sin(jishin_rad)*a)
funshin = (cos(funshin_rad)*b, sin(funshin_rad)*b)

x_diff = jishin[0] - funshin[0]
y_diff = jishin[1] - funshin[1]
print(sqrt(x_diff**2 + y_diff**2))
import math
A,B,H,M = map(int, input().split())
time = H * 60 + M

Asita = time / 720
Bsita = (time % 60) / 60
sita = abs(Asita - Bsita) * 2 * math.pi

Ans = ( A**2 + B**2 - 2 * A * B * abs(math.cos(sita)))**0.5
print(Ans)
a,b,h,m = map(int,input().split())
import math
sitah = 30 * h + 0.5 * m
sitam = 6 * m
sitax = abs(sitah - sitam)
sitax = sitax % 180
kosain = (math.cos((math.radians(sitax))))
x2 = a**2 + b**2 - 2*a*b*kosain
ans = math.sqrt(x2)
print(ans)
import math

a,b,h,m = list(map(int,input().split()))
h = h % 12
theta = m*6 - h*30
arc = a** 2 + b**2 - 2*a*b*math.cos(math.radians(theta))
print(arc**0.5)
import math

a,b,h,m = map(int, input().split())
start = 30*h
d = min(abs(start - 5.5 * m),360-abs(start - 5.5 * m))
if int(d)!=90 and int(d)!= 0:
    c = math.cos(math.radians(d))
    k = a**2+b**2-2*a*b*c
    ans = math.sqrt(k) 
    print(ans)
elif int(d) == 0:
    print(abs(a-b))
elif int(d) ==90:
    k= a**2+b**2
    ans = math.sqrt(k)
    print(ans)
d=input()
abhm=d.split()

import math
A = int(abhm[0])
B = int(abhm[1])
H = int(abhm[2])
M = int(abhm[3])
c_2=A**2+B**2-2*A*B*math.cos(abs((M*0.5+H*30)-M*6))
C=math.sqrt(c_2)
print(C)
import math

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

hh = h * 30
mm = m * 6
do = max(hh, mm) - min(hh, mm)
do = min(do, 360 - do)
sin = math.sin(math.radians(do))
if do == 90:
    print(math.sqrt(a ** 2 + b ** 2))

elif do > 90:
    hi = b * sin
    a_sub = math.sqrt(b ** 2 - hi ** 2)
    hy = math.sqrt((a + a_sub) ** 2 + hi ** 2)
    print(hy)

elif do < 90:
    hi = b * sin
    a_sub = math.sqrt(b ** 2 - hi ** 2)
    hy = math.sqrt((a_sub - a) ** 2 + hi ** 2)
    print(hy)
import math

a, b, H, M = map(int, input().split())
a_ = 360 / 12
b_ = 360 / 60
a_x = a * math.sin(math.radians(a_ * H))
a_y = a * math.cos(math.radians(a_ * H))
b_x = b * math.sin(math.radians(b_ * M))
b_y = b * math.cos(math.radians(b_ * M))

print(math.sqrt((b_x - a_x) ** 2 + (b_y - a_y) ** 2))
import math

a,b,h,m = map(float,input().split())
if 6*m>30*h+m*0.5:
  angle = 6*m - 30*h+m*0.5
else:
  angle = 30*h+m*0.5 - 6*m
  
if angle>180:
  angle = 360-angle
  
c = math.sqrt((a**2) + (b**2) - (2*a*b*math.cos(math.radians(angle))))
  
print(c)
import math
def colon(a, b, h, m):
  hour = 0.5 * (h * 60 + m) 
  minute = 6 * m
  angle = abs(hour - minute)
  angle = min(360 - angle, angle)
  rad = angle*0.0174533
  #print(angle, rad)
  ans = math.sqrt(a**2+b**2-(2*a*b*(math.cos(rad))))
  return ans
  

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

A, B, H, M = (int(x) for x in input().split())

if M * 360 / 60 > 180 :
    minuteAngle = M * 360 / 60 - 180
else : minuteAngle = M * 360 / 60

if M * 30 / 60 + H * 30 > 180 :
    hourAngle = M * 30 / 60 + H * 30 - 180
else : hourAngle = M * 30 / 60 + H * 30

if minuteAngle < hourAngle :
    angleC = hourAngle - minuteAngle
else : angleC = minuteAngle - hourAngle

print(angleC)
angleC = math.cos(math.radians(angleC))

print(math.sqrt((A ** 2) + (B ** 2) - (2 * A * B * angleC)))
import math

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

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

HH=(H*(1/6)*math.pi)%(2*math.pi)
MM=(M*(1/30)*math.pi)%(2*math.pi)

ans=A**2+B**2-2*A*B*math.cos(MM-HH)
print(ans**0.5)
import math 
A,B,H,M = map(int,input().split())
print(( A**2 + B **2 - 2*B*A*(math.cos(math.radians(abs(30*H-6*M)))) )**0.5)
import math

zi, hun, H, M = map(int, input().split())
tan = H*30+M*0.5
tyo = M*6
bus = (tan-tyo)/90
ans = math.sqrt((zi**2)+(hun**2)) * bus
print(ans)
import math
A, B, H, M = map(float, input().split())

kakudo = (30 * H + 0.5 * M)  - 6 * M
if kakudo > 180:
    kakudo -= 180
# print(kakudo)

ans2 = A ** 2 + B ** 2 - 2 * A * B * math.cos(math.pi * (kakudo / 180))
# print(ans2)
print(math.sqrt(ans2))
import sys
import math

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

rad_B = M * 6
rad_A = H * 30 + M * 0.5

if rad_A < rad_B:
    rad_C = rad_A - rad_B
elif rad_A > rad_B:
    rad_C = rad_B - rad_A
elif rad_A == rad_B:
    rad_C = 0

rad_C = abs(rad_C)

if rad_C > 180:
    rad_C = 360 - rad_C

#print(rad_A,rad_B,rad_C)

cos_C = math.cos(math.radians(rad_C))

C_2 = A ** 2 + B ** 2 + 2 * A * B * cos_C

C = math.sqrt(C_2)

#print(rad_A,rad_B,rad_C)
print(C)
import math
A, B, H, M = map(int, input().split())
KAKUDO=min(abs((H*30)-(M*6)),abs((M*6)-(H*30)))
KAKUDO=min(KAKUDO,(360-(H*30))+(M*6),)
ANS= (A**2)+(B**2)-(2*A*B*math.cos(math.radians(KAKUDO)))
print(math.sqrt(ANS))
import math

h_hand_len, m_hand_len, h, m = map(int, input().split())

m_radian = math.radians(m * 6)
h_radian = math.radians(h * 30) + m_radian/12.0

diff = abs(m_radian - h_radian)
if diff > math.pi:
    diff = diff - math.pi
    
ab = float(h_hand_len) * float(m_hand_len) * math.cos(diff)

ans = math.sqrt(h_hand_len**2 + m_hand_len**2 - 2.0 * ab)
print(ans)
import math
a,b,h,m=map(int,input().split())
h=h*30+(m/60)*30
m=m*6
diff=abs(h-m)
if(diff>180):
    diff=diff-180
ans=a*a+b*b-2*a*b*abs(math.cos(diff*((math.pi)/180)))
print(math.sqrt(ans))
import math
A,B,H,M = map(int,input().split())
angle = 360*abs(H/12-M/60)
angle = math.radians(angle)
print((A**2 + B**2 - 2*A*B*math.cos(angle))**(1/2))
import math
import decimal
a,b,h,m = map(int,input().split())
long = m/60*360
short = h*30+(m/60*30)
kakudo = abs(long-short)
if kakudo > 180:
    kakudo -= 180 
dum = kakudo/180*3.141592653589793238462643
radi = math.cos(dum)
ans = a**2 + b**2 - (2*a*b*radi)
ans = ans ** (1/2)
print(ans)
import math
a,b,h,m = map(int,input().split())
deg = h*30+m*0.5-m*60
if deg <0:
    deg = -deg
elif deg>180:
    deg = 360-deg
bb = b*math.sin(math.radians(deg))
aa = a-b*math.cos(math.radians(deg))
print(math.sqrt((aa**2)+(bb**2)))
A,B,H,M = map(float, raw_input().split())

x = 12.0/360.0*H
y = 60.0/360.0*M

if x < y:
    x,y = y,x

C = (A**2.0+B**2.0)**(0.5)
print C
import math
a,b,h,m = map(int , input().split())
long_needle =(5 * m)/60 + h * 5  
sort_needle = m
ans = math.sqrt(a**2 + b **2 - 2*a*b*abs(math.cos(abs(math.pi*(long_needle-sort_needle))/30)))
print(ans)
import math

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

degH = H*360/12 + M*360/12/60
degM = M*360/60

angle = abs(degH-degM)

dist = 0
if angle == 0:
  dist = 0
else:
  dist = (A**2 + B**2 - 2*A*B * math.cos(math.radians(angle)))**(1/2)

print(dist)
import math

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

d_a = h * 30 + m * 0.5
d_b = m * 6
if d_a > d_b:
    d_a, d_b = d_b, d_a

d = d_b - d_a
if d > 180:
    d -= 180

# print(d)

if d == 180:
    print(a + b)
else:
    print(math.sqrt(a ** 2 + b ** 2 - 2 * a * b * math.cos(math.radians(d))))
import math

l=list(map(int, input().split(' ')))
a=l[0]
b=l[1]
h=l[2]
m=l[3]
hours = (h+m/60)/12
minutes = m/60
theta = 2*math.pi*(hours-minutes)
ans = a**2+b**2+2*a*b*math.cos(theta)
print(ans**0.5)
import numpy as np
import math

a, b, h, m = map(int, input().split())
h_dash = (h + m / 60.0) * 30.0
m_dash = m * 6.0
theta = abs(h_dash - m_dash)

if theta > 180.0:
    theta = theta - 180.0

if theta == 0.0:
    print(abs(a - b))
    quit()

if theta == 180.0:
    print(a + b)
    quit()

c_dash = a * a + b * b - (2.0 * a * b * math.cos(math.radians(theta)))

print(math.sqrt(c_dash))
import math

def colon():
    input_value = [int(i) for i in input('Enter values: ').split()]
    hour_hand = input_value[0]
    minute_hand = input_value[1]

    hour = input_value[2]
    minute = input_value[3]

    degree = (((hour * 60 + minute) * 360)/720) - ((minute * 360)/60)
    cos = math.cos(math.radians(degree))

    answer = math.sqrt((hour_hand ** 2) + (minute_hand ** 2) - (2 * hour_hand * minute_hand * cos))
    print(answer)

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

m = 0
if M != 0:
    m = M / 5

if H == 0:
    h = 12
else:
    h = H*30
if m == 0:
    mm = 360
else:
    mm = m*30

if h >= mm:
    rad = (h+0.5*M)-(mm)
else:
    rad = (mm)-(h+0.5*M)

ans = A**2 + B**2 - 2*A*B*(math.cos(math.radians(rad)))
print(ans**0.5)
import math
A, B, H, M = map(int, input().split())

H_deg = H*30 + M*0.5 if H < 6 else (H-12)*-1*30 - M*0.5
M_deg = M*6
if M <= H*5:
    degree = H_deg + M_deg
else:
    degree = M_deg - H_deg

if degree == 180:
    print(A+B)
elif degree < 180:
    c = math.sqrt(A**2+B**2-2*A*B*math.cos(math.radians(degree)))
    print(c)
else:
    c = math.sqrt(A**2+B**2-2*A*B*math.cos(math.radians(360-degree)))
    print(c)
import math

A,B,H,M = map(int, input().split())
##Aは短針の長さ、Bは長針の長さ
##ARは短針の進んだ針の角度、BRは長針の進んだ針の角度
AR = 360*H/12+30*M/60
BR = 360*M/60

if abs(AR-BR)<180:
  X = abs(AR-BR)
elif abs(AR-BR)>180:
  X = abs(AR-BR)-180
else :
  X = 0

C = A*A+B*B-abs(2*A*B*math.cos(math.radians(X)))

if X ==0:
  print(A+B)
else:
  print(C**0.5)
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(b-a)
else:
  ans=(a**2)+(b**2)-(2*a*b*math.cos(math.radians(ang)))
  print(math.sqrt(ans))
import numpy as np
A,B,H,M = map(int,input().split())

th_a = 30 * H
th_b = 6 * M

theta = th_a - th_b

C = np.sqrt(A**2 + B**2 - 2*A*B*np.cos(theta))
import math
A, B, H, M = map(int, input().split())
h = (H / 12 + M / 720)
m = M / 60
rad = (abs(h-m) * 360) % 180
print( round((A**2 + B**2 - 2 * A * B *  round(math.cos( math.radians(rad) ),20) )** 0.5, 10) )
# -*- coding: utf-8 -*-
import math
a, b, h, m = map(int, input().split())

theta_a = math.pi * float(h + m / 60) / float(6)
theta_b = math.pi * float(m) / float(30)

theta = theta_a - theta_b
print(theta)
if theta > math.pi or theta < 0:
    theta = theta_b - theta_a

square_l = - float(2) * math.cos(theta) * float(a*b) + a * a + b * b
print(math.sqrt(square_l))
import numpy as np
A,B,H,M = (int(x) for x in input().split())
argA = 30*H + 0.5*M
argB = 6*M
if argA>argB:
    arg = argA-argB
else:
    arg = argB-argA
    
if arg > 180:
    arg -= 180
    
cc = A**2 + B**2 -2*A*B*np.cos((arg/180)*np.pi)
c = np.sqrt(cc)

print(c)
import sys
import math
readline = sys.stdin.buffer.readline
def even(n): return 1 if n%2==0 else 0

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

degree = abs(h*30+30*(m/60) - m*6)
degree = min(degree,360-degree)
if degree == 0 or degree == 180:
    print(0)
    exit()
print(math.sqrt(a**2+b**2-2*a*b*math.cos(math.radians(degree))))
import math
A, B, H, M = map(int, input().split())

long = M * 6
short = (H*60 + M) * 0.5
k = short - long
if k > 180:
    k -= 180 
a = (A**2) + (B**2) - (2*A*B*math.cos(math.radians(k)))
print(a**(1/2))
import math

a,b,h,m = (int(x) for x in input().split())
print(a)
dh = 30*h
dm = 6*m
ab = abs(dh-dm)
if ab == 0:
  print(abs(a-b))
elif ab == 180:
  print(a+b)
elif ab < 180:
  print(math.sqrt(a**2+b**2-2*a*b*math.cos(math.radians(ab))))
else:
  print(math.sqrt(a**2+b**2-2*a*b*math.cos(math.radians(360-ab))))
import math

a, b, h, m = map(int, input().split())
l = m * 6
s = m * 0.5 + h * 30
th = abs(l - s)
if th == 0:
    print(abs(a - b))
    #print('{:.20f}'.format(abs(a - b)))
    exit()
elif th == 180:
    print(a + b)
    #print('{:.20f}'.format(a + b))
    exit()
if th >= 180:
    th -= 180
cos = math.cos(math.radians(th))
ans = a**2 + b**2 - 2 * a * b * cos
print(ans**0.5)
#print('{:.20f}'.format(math.sqrt(ans)))
import math

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

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

rad = max(rad_hour, rad_min) - min(rad_hour, rad_min)

x = (math.pow(a,2) + math.pow(b,2) - (2*a*b*math.cos(2*math.pi - rad)))
print(math.sqrt(x))
import math

inputLine = input()
tempStr = inputLine.split(' ')

a = int(tempStr[0])
b = int(tempStr[1])
h = int(tempStr[2])
m = int(tempStr[3])

minDeg = 360 * (m / 60)
hourDeg = h * 30 + (30 * (m / 60))

finalValue = hourDeg - minDeg if hourDeg >= minDeg else minDeg - hourDeg
finalValue = 360 - finalValue if finalValue >= 180 else finalValue

if finalValue == 90 or finalValue == 180 :
	print(math.sqrt((a * a) + (b * b)))
elif finalValue == 0 :
	print(0)
else :
	print(math.sqrt((a * a) + (b * b) - (2 * a * b * math.cos(math.pi * (finalValue / 180)))))
import math
import decimal


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

angle_m = m * 60
angle_h = h * 30 + m / 2

angle = abs(angle_h - angle_m)
angle = math.radians(min(angle, 360 - angle))

ans2 = pow(b * math.cos(decimal.Decimal(f'{angle}')) - a, 2) + pow(b * math.sin(decimal.Decimal(f'{angle}')), 2)
ans = decimal.Decimal(f'{ans2}').sqrt()
print(ans)
import math
a,b,h,m = map(int,input().split())

aangle = m * 6
bangle = h * 30

diff = abs(aangle - bangle)
if diff > 180:
    diff -= 180

#print(diff,a,b,round(math.cos(math.radians(diff)),10))
print((a*a + b*b - 2 * a * b * round(math.cos(math.radians(diff)),10)) ** 0.5)
import math
a,b,h,m = map(int,input().split())
short = h*30+m/2
long = m*6
ang = abs(short-long)
ang = ang if ang <= 180 else ang-180
hen = math.sqrt(a**2+b**2-2*a*b*math.cos(math.radians(ang)))
print(hen)
import math

a, b, h, m = map(int, input().split())
mins= 60 * h + m
ho = mins%720
so = mins % 60
ho /= 720
so /= 60
shita = abs(ho-so) * 360
if shita > 180:
    shita -= 180
shita = math.radians(shita)
ans = (a ** 2  + b ** 2 )*10000000
ans -= 2 * a * b * math.cos(shita)* 10000000
ans /= 10000000
ans = math.sqrt(ans)

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


if h==0:
    hh = 360
else:
    hh = 360*(h/12)+(30*m/60)
if m==0:
    mm = 360
else:
    mm = 360*(m/60)
    
x = float(abs(mm-hh))

a2 = a**2
b2 = b**2

ans = math.sqrt((a2+b2)-(2*a*b*math.cos(math.radians(x))))
print(format(ans,'.15f') )
import math

stdata = [0]*4
stdata = input().split()
plase = [0] * 4
plase[0] = float(stdata[0]) * math.sin(math.pi * 2 / 12 * float(stdata[2]))
plase[1] = float(stdata[0]) * math.cos(math.pi * 2 / 12 * float(stdata[2]))
plase[2] = float(stdata[1]) * math.sin(math.pi * 2 / 60 * float(stdata[3]))
plase[3] = float(stdata[1]) * math.cos(math.pi * 2 / 60 * float(stdata[3]))
temp = math.sqrt(float(plase[2] - plase[0]) * float(plase[2] - plase[0]) + float(plase[3] - plase[1]) * float(plase[3] - plase[1]))
print(temp)
import math
 
[a, b, h, m] = [int(x) for x in input().split(" ")]
short = ((h) * 60 + m) / (12 * 60) * 360
long = (m) / (60) * 360
theta = abs(long - short)
inte = math.cos(math.radians(theta))
print(math.sqrt(a ** 2 + b ** 2 + 2*a * b * inte))
a,b,h,m = map(int,input().split())
import math
t =abs(30*h + 0.5*m - 6*m)
angle = min(t, 360-t)

l = a**2 + b** 2 -2*a*b*math.cos(angle*3.1415/180)
print(l**0.5)
import math

li = list(map(int,input().split()))
A=li[0]
B=li[1]
H=li[2]
M=li[3]

long = M/60 * 360
short = H/12 * 360 + M/60 * 30

def f(a,b,angle):
    c2 = a*a + b*b -2*a*b*math.cos(math.radians(angle))
    return math.sqrt(c2)

angle = 0
ans = 0
if(short==long):
    ans = abs(A-B)
elif(abs(short-long) == 180):
    ans = A+B
else:
    angle = abs(short-long)
    if(angle > 180):
        angle = 180 - angle
    ans = f(A,B,angle)

print(ans)
import math
a,b,h,m=map(int,input().split())
t=abs(h/12-m/60)
print((a**2+b**2+2*a*b*math.cos(2*math.pi*t))**0.5)
import math
A,B,H,M = map(int, input().split())
a = 360*H/12+30*M/60
b = 360*M/60
c = abs(a-b)
d = A**2+B**2-2*A*B*math.sin(math.radians(c))
print(math.sqrt(d))
import math
in1 = input().split()
A = float(in1[0])
B = float(in1[1])
H = float(in1[2])
M = float(in1[3])
aH = 0.5 * (H * 60 + M)
aM = 6*M
ra = abs(aH-aM)
ra1 = min(360 - ra, ra)
C2 = ((A*A)+(B*B))- (2*(A*B))*(math.cos(math.radians(ra1)))
print(math.sqrt(C2))
print(ra1)
import math
A, B, H, M = map(int, input().split())
if H==0:
    H = 60
else:
    H *= 5
if M==0:
    M = 60
deg =abs(H-M)*6
cos = math.cos(math.radians(deg))
print(((A**2)+(B**2)-2*A*B*cos)**0.5)
import math
a,b,h,m=map(int,input().split())
time= 60*h + m
H=time*0.5
M=(time*6) % 360
angle=(abs(H-M))%180
ans=math.sqrt(a**2 + b**2 - 2*a*b*math.cos(math.radians(angle)))
print(ans)
from math import pi
from math import cos
from math import sqrt


a, b, h, m = map(int, input().split())
h *= 5
dist = abs(h - m)
ang = 2 * pi / 60 * dist + m / 60 * pi / 6

res = sqrt(a**2 + b**2 - 2 * a * b * cos(ang))
print(res)