peterverebics/CodeNet_Python_118 huggingface dataset:
import math

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

m_rad = math.pi * m / 60.
h_rad = math.pi * (h / 12.) + math.pi / 12. * (m / 60.)
m_x, m_y = b * math.cos(m_rad), b * math.sin(m_rad)
h_x, h_y = h * math.cos(h_rad), b * math.sin(h_rad)
print(math.sqrt((m_x - h_x)**2 + (m_y - h_y)))
import math
from math import cos


def time():
    A, B, H, M = map(int, input().split())
    minuteAngel = (float(M) * 360) / 60
    hourAngel = (float(H) % 12) * 30 + (float(M) * 30) / 60
    angel = abs(hourAngel - minuteAngel)
    a = cos(angel / 180 * math.pi)
    a = float('%.30f' % a)
    diatance = math.sqrt(A * A + B * B - 2 * A * B * a)
    print("%.20f" % diatance)
a,b,h,m = map(int,input().split())

long = m * 60
small = h * 30 + m * 0.5

kakudo = min(abs(long - small), 360-abs(small-long))

import math

ans = (a ** 2 + b ** 2 - 2 * a * b * math.cos(math.radians(kakudo))) ** (1/2)

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


th_a = 360/12 * h + 360/12*m/60
th_b = 360*m/60
print(th_a)
print(th_b)
ab_th = abs(th_a - th_b)
if ab_th > 180:
    ab_th = 360 - ab_th

print(math.sqrt(a*a + b*b -2*a*b*math.cos(math.radians(ab_th))))
import math

def abs(x):
  return x if x >= 0 else x < 0 -x

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

x = 30 * h + 0.5 * m
y = 6 * m

ang = abs(x - y)
  
print(math.sqrt(a**2 + b**2 - 2*a*b*math.cos(math.radians(ang))))
abhm=tuple(map(float, input().split()))
a=abhm[0]
b=abhm[1]
h=abhm[2]
m=abhm[3]

import math as mt

pi=mt.pi
print(pi)

c=pi*(h+m/60)/6
d=pi*m/30

print(mt.sqrt((a*mt.cos(c)-b*mt.cos(d))**2+(a*mt.sin(c)-b*mt.sin(d))**2))
import math

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


if M == 0 and H == 6:

    print(A+B)

elif M == 0 and H == 0:

    print(abs(A-B))

elif M == 0:

    if H == 3 or H == 9:

        print(math.sqrt(A ** 2 + B ** 2))

else:

    angulo = abs(11 * M - 60 * H)/2

    angulo = math.radians(angulo)

    print(abs(math.sqrt((A**2 + B ** 2) -  (2 * A * B * math.cos(angulo)))))
import math

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

angle = abs(30*h - 6*m)
dangle = angle if angle <= 180 else 360 - angle
d = math.sqrt(a**2 + b**2 - 2*a*b * math.cos(math.radians(dangle)))
print(d)
import math
import sys
a,b,h,m = map(int,input().split())
h_ = h*30 + (m/60) * 30
m_ = m*6
alpha = h_ - m_
if 0 < alpha < 180:
    pass
elif alpha == 180:
    print(h+m)
    sys.exit()
elif alpha == 0:
    print(abs(a-b))
    sys.exit()
else:
    alpha = 360 - alpha
ans_2 = a**2 + b**2 - 2 * b * a * math.cos(math.radians(alpha))
print(ans_2 ** 0.5)
import math

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

degree = abs((H * 60 + M) / 2 - M * 6) % 180

d = A**2 + B**2 - 2 * A * B * math.cos(math.radians(degree))
ans = d**0.5

print(ans)
import math
a, b, H, M = list(map(int, input().split()))
omega_a = 30 * H % 360
omega_b = 5.5 * M % 360
if (abs(omega_a-omega_b) > 180):
    thita = abs(omega_a-omega_b) - 180
else:
    thita = abs(omega_a-omega_b)
# print(thita)
cos = math.cos(math.radians(thita))
c = math.sqrt(a**2 + b**2 - 2*a*b*cos)
print(c)
import math
A, B, H, M = map(int, input().split())

a = 6*M
b = 30*H + 0.5*M

if a==b:
    print(abs(A+B))
    exit()
elif a < b:
    dif = b - a
else:
    dif = a - b

if int(dif) == 180:
    print(A+B)
else:
    deg = dif%180
    print(math.sqrt(pow(A,2)+pow(B,2)-(2*A*B*math.cos(math.radians(deg)))))
import math
def main():
  a, b, h, m = map(int, input().split())
  rad = abs(h * 30 - m * 6)
  temp = 360-rad
  if rad > temp:
    rad = temp
  # print(rad)
  rad = math.radians(rad)
  ans = math.sqrt((a ** 2) + (b ** 2) - 2 *a*b*math.cos(rad))
  print(ans)
  # print(a**2, b**2, 2 * a*b*math.cos(rad),rad,math.cos(rad),rad)

if __name__ == '__main__':
  main()
import math
import sys
a,b,h,m = map(int,input().split())
h_ = h*30 + (m/60) * 30
m_ = m*6
alpha = h_ - m_
if 0 < alpha < 180:
    pass
elif alpha == 180:
    print(h+m)
    sys.exit()
elif alpha == 0 or alpha == 360:
    print(abs(a-b))
    sys.exit()
else:
    alpha = 360 - alpha
ans_2 = a**2 + b**2 - 2 * b * a * math.cos(math.radians(alpha))
print(ans_2 ** 0.5)
# -*- coding: utf-8 -*-
import math
# 入力
a,b,h,m = map(int,input().split())

tri_m = 360 / 60 * m 

tri_h = (360 / 12 * h) + (360 / 12 / 60 * m)

# print("tri_m:{},tri_h:{}".format(tri_m,tri_h))
angle = abs(tri_m - tri_h)
if angle > 180:
  angle -= 180

# print("angle:{}".format(angle))

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

print(ans)
import math
a, b, h, m  = map(int, input().split())
theta = (h * 60 * 0.5+ m * 0.5) % 360 - (h * 60 * 6 + m * 6) % 360

if theta > 180:
    theta = 360 - theta

ab = math.sqrt(a**2+b**2-2*a*b*math.cos(theta))
print(ab)
import math

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

hus = math.sin(math.radians((m*6)))
huc = math.cos(math.radians((m*6)))
jis = math.sin(math.radians((h*(360/12)))+math.radians((m*360)))
jic = math.cos(math.radians((h*(360/12)))+math.radians((m*360)))


print((math.sqrt((b*hus+a*jis)**2)+((b*huc+a*jic)**2)))
import math

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

sita1=M*360/60
sita2=H*360/12+0.5*40
a=abs(sita1-sita2)
x1 = B*math.cos(math.radians(sita1))
y1 = B*math.sin(math.radians(sita1))
x2 = A*math.cos(math.radians(sita2))
y2 = A*math.sin(math.radians(sita2))

d = math.sqrt(A*A+B*B-2*A*B*math.cos(math.radians(a)))

print('{:.20f}'.format(d))
import math
A,B,H,M=map(int,input().split())
c=abs(H*15-M*6)
k=A*A+B*B-2*A*B*math.cos(c*math.pi/180)
l=math.sqrt(k)
print(l)
import math
A, B, H, M = map(int, input().split())

if 30 * H == 6 * M:
    kakudo = 0
elif 30 * H > 6 * M:
    kakudo = 30 * H - 6 * M 
elif 30 * H < 6 * M:
    kakudo = 6 * M - 30 * H

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

print(math.sqrt(ans))
import math
A, B, H, M = map(int, input().split())
H *= 30
M *= 6
rad = 0
if H > M:
    rad = H - M
else:
    rad = M - H

if rad >= 180:
    rad = 360 - rad
cosRad = math.cos(math.radians(rad))
x = A**2 + B**2 - (2*A*B*cosRad)
print(math.sqrt(x))
import math
a, b, h, m = map(int, input().split())
h_v = h * 30
m_v = m * 6
k = abs(h_v-m_v)
if k > 180:
	k = 360 - k
radian = math.radians(k)
r2 = a**2 + b**2 - 2 * a * b * math.cos(radian)
print(r2**0.5)
import math
A, B, H, M = map(int,input().split())


ha = 0.5 * (60 * H)
ma = 6 * M
angle = min(360 - abs(ha - ma), abs(ha - ma))

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

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


def choshin_angle(m):
    return 6 * m

def tanshin_angle(h, m):
    return 0.5 * (60 * h + m)

theta = abs(tanshin_angle(h, m) - choshin_angle(m))

if (theta > 180.):
    theta -= 180.

theta = math.radians(theta)

x2 = a**2 + b**2 - 2 * a * b * math.cos(theta)

x = math.sqrt(x2)

print(x)
import sys
import math

a, b, h, m = tuple(map(int, sys.stdin.buffer.read().split()))

mm = m / 60
hh = (h + mm)  / 12
r = (mm - hh) * math.pi * 2
print(a, b, h, m, hh, mm)
print(math.sqrt(a ** 2 + b ** 2 - 2 * a * b * math.cos(r)))
A, B, H ,M = map(int,input().split())

import math

if H == 12:
    H = 0

a_rad = 2 * math.pi * (H / 12 + M / 720)
b_rad = 2 * math.pi * (M /60)

ab_rad = a_rad - b_rad

if ab_rad == math.pi:
    d = A + B
if ab_rad == 0:
    d = B - A
if 0 < ab_rad < math.pi:
    d = math.sqrt(A**2 + B **2 - 2*A*B*math.cos(ab_rad))
else:
    d = math.sqrt(A**2 + B **2 - 2*A*B*math.cos(ab_rad - math.pi))
print(d)
import math
pi=3.1415926535897932
a,b,h,m=map(int,input().split())
ad=h*30+m*0.5
bd=m*6
x=min(abs(ad-bd),360-abs(ad-bd))
if abs(x-180.0)<0.0000000001:
    print(a+b)
    exit()
elif abs(ad-bd)<0.000000001:
    print(0)
    exit()
ans=a**2+b**2-(2*a*b*math.cos(math.radians(x)))
print(abs(ans**0.5))
import math
A,B,H,M = map(int, input().split())
sita = (0.5 * M - 30 * H) % 360
ans = (A**2 + B**2 - 2 * A * B * math.cos(math.radians(sita)))** 0.5
print(ans)
A,B,H,M=map(int,input().split())
import math
print(type(B))
x=A*A+B*B
y=-2*A*B*(math.cos(math.radians(abs(0.5*(60*H+M)-6*M))))
print('{:10}'.format(math.sqrt(float(x)+y)))
import math

a, b, h, m = map(int, input().split())
m_ang = 360 * m / 60
h_ang=360*h/12+30*m/60
angle = abs(m_ang-h_ang)
if angle > 180:
    angle = 360 - angle
elif angle > 90:
    angle -= 90

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

print(d)
import math

a,b,h,m=map(float,input().split())
seconds=h*60+m
kaku=seconds*5.5
g_kaku=kaku%180
p_kaku=math.radians(g_kaku)
cos=math.cos(p_kaku)
l=a**2+b**2-2*a*b*cos
len=math.sqrt(l)
print(len)
a, b, h, m = map(int, input().split())
h = h * 30
m = m * 6
angle =  abs(360 * (abs(h-m) // 180) - abs(h-m))
import math
a_2 = a ** 2 + b ** 2  - 2 * a * b * math.cos(angle)
print(a * .5)
import math
A,B,H,M = [int(i) for i in input().split()]

tmp = H/12 - M/60
rad = math.radians(tmp*360)
c2 = A*A + B*B - 2*A*B*math.cos(rad)
print(math.sqrt(c2))
from decimal import *
import math
a,b,h,m = map(Decimal,input().split())
getcontext().prec = 20
orig = abs((h*5)-m)*30
orig = min(360-orig,orig)
rad = Decimal(math.radians(orig+(Decimal(m)/Decimal(2))))
c = Decimal(math.sqrt((a*a)+(b*b)-(2*a*b*Decimal(math.cos(rad)))))
print(c)
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 and int(d)!= 180:
    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) == 180:
    print(a+b)
elif int(d) == 90:
    k = a**2+b**2
    ans = math.sqrt(k)
    print(ans)
import math
A,B,H,M = map(int,input().split())
A2 = A**2
B2 = B**2
a = 30*H + 0.5*M
b = M*6
F  = 0

ab = min(abs(a-b),abs(360-a-b))

if abs(a-b) == 180:
    F = 1
    print(A+B)
elif abs(a-b) == 0:
    F = 1
    print(abs(A-B))
else:
    angle = math.cos(math.radians(ab))

if F == 0:
    ab_angle = -2*A*B*angle
    ans = math.sqrt(A2 + B2 +ab_angle)
    print(ans)
# coding: utf-8
# Your code here!

import math

a,b,h,m=map(int,input().split())
d=abs(h-m)
d=min(12-d,d)*30
c=a**2+b**2-2*a*b*math.cos(math.radians(d))
print('{:.23f}'.format(c**(1/2)))
import  numpy as np

def kaku(h,m):
    PI = 3.14159265358979323846
    hum = h * 60 + m
    rad = hum / 360 * PI
    return rad

def yogen(a, b, kaku):
    tmp = pow(a, 2) + pow(b, 2) - 2 * a * b * np.cos(kaku)
    return np.sqrt(tmp)
    

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

hour_rad = kaku(h, m)
min_rad = kaku(0, m) * 12
rad = abs(min_rad - hour_rad)
ans = yogen(a, b, rad)
print(hour_rad)
print(min_rad)
# print(min_rad)    

print(ans)
import math

def kyori(a,b,c,d):
    return math.sqrt(a**2+b**2-2*a*b*math.cos(abs(c-d)))

A, B, H, M = [int(i) for i in input().split()]
h = H* 2*math.pi/12 #rad
m = M* 2*math.pi/60 #rad
#print(h, "\n", m)


k=kyori(A,B,h,m)
print(k)
import math

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


x = abs(30 * h + 0.5 * m - m) * math.pi / 180

if x > 180:
    x = x - 180

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

print(ans)
import math

a,b,h,m = map(int,input().split())
ab =a*a+b*b
print(math.sqrt(ab))
import math
a,b,h,m=map(int,input().split())
hh=h/12*360 + m/60*30
mh=m/60*360 
if mh==0:
    mh=360
#print(hh,mh)
x=abs(hh-mh)

print((a**2+b**2-abs(2*a*b*math.cos(x*math.pi/180)))**0.5)
import math
a,b,h,m=map(int,input().split())

def kakudo(hour,mini):
    jikan=30*hour+0.5*mini
    fun=60*mini
    k=abs(jikan-fun)
    if k>180:
        k=360-k
    k=k*math.pi/180
    return k 

def cal(k):
    c=a**2+b**2-2*a*b*math.cos(k)
    return c**0.5

ans=cal(kakudo(h,m))
print(ans)
import math
a, b, H, M = map(int, input().rstrip().split())
if H == 0 and M == 0:
    print(0)
else:
    H = H * 5 + (float(M) / 12)
    kakudo = abs(H - M)
    kakudo *= 6
    print(math.sqrt(float(a * a) + float(b * b) - 2 * a * b * math.cos(math.radians(kakudo))))
import math
p = math.pi
a,b,h,m = map(int,input().split())
#c^2=a^2+b^2-2abcostheta
mi = 6*m
ho = 30*h+m/2
t = abs(ho-mi)
if t > 180:
    t = 180-t
t *=p/180
ans = (a**2+b**2-2*a*b*math.cos(t))**(0.5)
print('{:.18f}'.format(ans))
import numpy as np
a, b, h, m = map(int, input().split())
h_a = ((h % 12)*360/12)%360
m_b = ((m % 60)*360/60)%360
angle = 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())
if H!=0:
    H *= 5
deg =abs(H+M/12-M)*6
if deg==0:
    print(B-A)
    exit()
if deg==180:
    print(A+B)
    exit()
cos = math.cos(math.radians(deg))
print(((A**2)+(B**2)-2*A*B*cos)**0.5)
A,B,H,M=map(int,input().split())

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

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))
import numpy as np
import math
pi = math.pi
a,b, h, m = map(int, input().split())
hkakudo = h*2*pi/12 + m*2*pi/720
mkakudo = m*2*pi/60
theta = abs(hkakudo-mkakudo)
if theta > pi:
    theta -= pi
print(np.sqrt(a**2 + b**2 - 2*a*b*np.cos(theta)))
import math

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

theta = abs((H + M / 60 ) / 12 - M / 60) * 2 * math.pi
#if theta > math.pi: theta -= math.pi

print(theta, math.cos(theta))

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

print(ans)
import math
pi = math.acos(-1)

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

alpha = 2 * h * pi / 12
beta = 2 * m * pi / 60

ans_2 = a ** 2 + b ** 2 - 2 * a * b * math.cos(abs(beta - alpha))
ans = math.sqrt(ans_2)

print(ans)
import math

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

cho = (H * 60 + M) / (12 * 60) * 360
tan = M / 60 * 360
degree = abs(cho-tan)
if degree > 180:
    degree = degree - 180

ans_2 = A**2 + B**2 - 2*A*B*math.cos(math.radians(degree))
print(math.sqrt(ans_2))
A, B, H, M = (int(i) for i in input().split())

h_degree = (360/12) * H + (360/12) * (M/60)
m_degree = (360/60) * M

diff_degree = abs(m_degree-h_degree)
print(min(diff_degree, 360-diff_degree))
A,B,H,M=map(int,input().split())
N=abs(H*30+M*0.5-M*6)
if N >= 180 :
    N=360-N
import math
ans2=A**2+B**2-2*A*B*math.cos((math.radians(N)))
#print(A**2,B**2,2*A*B,math.cos(math.radians(N)))
ans=math.sqrt(ans2)
import math

A, B, H, M = map(int, input().split())
a = float(A)
b = float(B)
h = float(H)
m = float(M)

arg_m = m * 6
arg_h = h * 30 + m / 2
arg_mh = arg_m - arg_h

if(abs(arg_mh)) == 180:
	print(a+b)
elif(arg_m == arg_h):
	print(abs(a-b))
else:
	cos_mh = abs(math.cos(math.radians(arg_mh)))
	C = a*a + b*b -2*a*b*cos_mh
	c = math.sqrt(C)
	print(c)
import math
 
a,b,c,d = map(float,input().split())

H = 30
M = 6

HM = 0.5

kakudo = abs((c*H+d*HM) - d*M)
 
if kakudo == 180:
  print(a+b)
elif kakudo == 0:
  print(0)
else:
  print(math.sqrt(pow(a,2) + pow(b,2) - 2*a*b*math.cos(math.radians(kakudo))))
from math import cos, radians, sqrt

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

degree = H * 360 / 12 + M * 360 / 60
C2 = A ** 2 + B ** 2 - 2 * A * B * cos(radians(degree))
print(sqrt(C2))
import math
lst=input().split()
lst=[int(p) for p in lst]

a=lst[0]
b=lst[1]
h=lst[2]
m=lst[3]

deg1=(60*h+m)/720
deg2=m/60

diff=abs(deg1-deg2)*360
if diff>180:
    diff=diff-180

v=math.cos(diff*math.pi/180)

sq=a**2+b**2-2*a*b*v

c=sq**(1/2)

print (c)
import math


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

pi = math.pi
Hrad = (H+(M/60))*2*pi/12
Mrad = M*2*pi/60

d = abs(Hrad-Mrad)

if d >= pi:
    d = d-pi

# print(math.degrees(d))

print(math.sqrt(A**2+B**2-2*A*B*math.cos(d)))
import math
a, b, H, M = list(map(int, input().split()))
omega_a = 30 * H % 360
omega_b = 5.5 * M % 360
if (abs(omega_a-omega_b) > 180):
    thita = abs(omega_a-omega_b) - 180
else:
    thita = abs(omega_a-omega_b)
# print(thita)
# cos = math.cos(math.radians(thita))
c = math.sqrt(a**2 + b**2 - 2*a*b*math.cos(math.radians(thita)))
print('{:.22g}'.format(c))
#!/usr/bin/env python3
import sys
input = sys.stdin.readline
import math

a, b, h, m = map(int, input().split())
deg_h = (h * 120 + m * 2) % 1440
deg_m = (m * 240) % 1440
diff = (deg_h - deg_m) % 1440
if deg_h >= deg_m:
    diff = deg_h - deg_m
else:
    diff = deg_m - deg_h
if 1440 - diff < diff:
    diff = 1440 - diff
c_sqr = a*a + b*b - 2.0 * a * b * math.cos(diff / 1440 * math.pi * 2)
print(math.sqrt(c_sqr))
import sys
input = sys.stdin.readline

import math

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

    x = abs((h*30+(m/2)) - m*6)

    if x == 0 or x== 360:
        print(abs(a-b))
    elif x == 180:
        print(a+b)
    else:
        if x > 180:
            x -= 180

        rad = math.radians(x)

        ans_2 = a*a + b*b - 2*a*b*(math.cos(rad))

        print(math.sqrt(ans_2))

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

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

A_angle = (H*60+M)*0.5
B_angle = M*0.6

#中心角度
angle = abs(A_angle - B_angle)

#cos
angle_rad = math.radians(angle)
cos = math.cos(angle_rad)
#余弦定理
ansans = A**2+B**2-2*A*B*cos
ans = math.sqrt(ansans)
print(ans)
import math

a,b,h,m = map(int, input().split())
h1 = int(h) * 30
m1 = int(m) * 5.5
r = abs(int(h1) - int(m1))
print(r)
a1 = int(a) ** 2
b1 = int(b) ** 2
ab = int(a) * int(b)
if 180 <= int(r):
  r1 = int(r) -180
else:
  r1 = r
print(r1)
cos = math.cos(math.radians(int(r1)))
d = int(a1) + int(b1) - 2 * int(ab) * float(cos)
ans = d ** (1/2)
print(ans)
import sys
import math

input = sys.stdin.readline
sys.setrecursionlimit(4100000)


def main():
    A, B, H, M = map(int, input().rstrip().split())
    theta_m = 2 * math.pi * M / 60
    theta_h = 2 * math.pi * (H * 60 + M) / (12 * 60)
    theta = (theta_h - theta_m) % math.pi
    ans = math.sqrt(A ** 2 + B ** 2 - 2 * A * B * math.cos(theta))
    # print(theta_m)
    # print(theta_h)
    # print(theta)
    print(ans)


if __name__ == '__main__':
    main()
import math
def main():
    A, B, H, M = map(int, input().split())
    r = M * 12 - (H * 60 + M)
    theta = (r*math.pi) / 360.0
    if theta >= math.pi:
        theta = math.pi - theta
    Cpow2 = A*A + B*B - 2*A*B*math.cos(theta)
    C = math.sqrt(Cpow2)
    print(C)

if __name__ == '__main__':
    main()
import math
a,b,c,d=input().split()
a=float(a)
b=float(b)
c=float(c)
d=float(d)
sa=(30*c+0.5*d)-6*d
if sa<0.000:
    sa=sa*(-1)
    sa=float(sa)
if sa>180.000:
    sa=sa-180
    sa=float(sa)
x=math.sqrt(a*a+b*b-2*a*b*float((math.cos(math.radians(sa)))))
print(x)
import sys
import itertools
sys.setrecursionlimit(1000000000)
from heapq import heapify,heappop,heappush,heappushpop
import math
import collections
import copy

a,b,h,m = map(int,input().split())
d1 = h*30 + m*0.5
d2 = m*6
kakudo = abs(d2-d1)
if kakudo>180:
    kakudo -= 180
ans = math.sqrt(a**2 + b**2 - 2*a*b*math.cos(math.radians(kakudo)))
print(ans)
import math
a, b, h, m = map(int, input().split())
# mazuha 角度から
hour = h / 12 * 360
mins = m / 60 * 360
#RH = math.radians(hour)
#MH = math.radians(mins)

tar = abs(hour - mins)
TR = math.radians(tar)

co = math.cos(TR)
cc = a ** 2 + b ** 2 - 2 * b * a * co
ans = float(cc ** 0.5)
print(ans)
a,b,h,m = map(int,input().split())

import math
x = (30*h)+30*(m/60)
y = (6*m)
s = (abs(x-y)%180)
#print(s,math.cos(math.radians(s)))

k = math.sqrt(a**2 + b**2 - 2*a*b*math.cos(math.radians(s)))

print(k)
a = input().split()
A = int(a[0])
B = int(a[1])
H = int(a[2])
M = int(a[3])
import math
aa = 30 * H + 0.5 * M
bb = M * 6

if aa == bb or abs(aa - bb) == 180:
  ans = A + B
else:
  if aa > bb:
    z = (360 - aa) + bb
  else:
    z = (bb - aa)
  if z > 180:
    z = 360 - z
  ans = (A**2 + B**2 - 2*A*B*math.cos(math.radians(z)))**(1/2)

print(ans)
from math import pi, cos
import math
s=input()	.split(" ")
a=float(s[0])
b=float(s[1])
h=float(s[2])
m=float(s[3])
mm=6*m
gg=float((h*60+m)/2)
alf=float(abs(gg-mm))
if(alf>180):
	alf-=180
alf=float(alf*pi/180)
x=a*a+b*b-a*b*2*cos(alf)
print("{:.12f}".format(math.sqrt(x)))
A,B,H,M = map(float, input().split())

import math

degreeA = float((H * 60 + M) / 2)
degreeB = float(M * 6)

if degreeA == degreeB:
    print(abs(A - B))
else:
    degreeAB = abs(degreeA - degreeB)
    if degreeAB == 180:
        print(A + B)
    elif degreeAB > 180:
        degreeAB = 360 - degreeAB
    C = float(A ** 2 + B ** 2 - 2 * A * B * float(math.cos(degreeAB * math.pi / 180)))
    print(math.sqrt(C))
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(3.1415926/180*(30*H-11*M/2))))
#C - : (Colon)
import math
A,B,H,M = map(int, input().split())
h = H*30
m = M*6
w = 0
h = h + 0.5*M
w = abs(h - m)
if w > 180:
    w = w-180
elif w == 180:
    print(abs(A+B))
    exit()
elif w == 0:
    print(abs(A-B))
    exit()
else:
    pass
#print(h,m,w)

c = A**2+B**2-2*A*B*math.cos(math.radians(w))
print(c**(1/2))
import math

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

theta=(60*h-11*m)/2
print(math.cos(math.radians(theta)))

print(math.sqrt(max(0,a*a+b*b-2*a*b*math.cos(math.radians(theta)))))
import math
A, B, H, M = map(int, input().split())
sd = H*30 + M*0.5
ld = M*6

c1 = 360 - ld - sd
c2 = sd - ld

if c1 > 0:
    ans = A**2 + B**2 - 2*A*B*math.cos(math.radians(c1))
else:
    ans = A**2 + B**2 - 2*A*B*math.cos(math.radians(c2))
print(f"{math.sqrt(ans):.10f}")
import math
def main():
    A, B, H, M = map(int, input().split())
    x = 30 * H - 60 * M + 0.5 * M
    x = math.radians(x)
    if x < 0:
        x = -x 
    if x == 1:
        return A + B
    x = min(x, 2*math.pi - x)
    C = A**2 + B**2 - 2 * A * B * math.cos(x)
    return math.sqrt(C)
print(main())
from decimal import Decimal
import numpy as np

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

deg = abs((h)*5 - m) * 6 + (m/2)#度
length = Decimal(str(a*a + b*b - 2*a*b*np.cos(np.deg2rad(deg))))**Decimal('0.5')

print(length)
import math
a, b, h, m = map(int, input().split())
c = abs((h+(m/60))*30 - m*6)
c = min(c, 360-c)
ans_2 = a**2 + b**2 - 2*a*b*math.cos(math.radians(c))
print(c, math.radians(c))
print(ans_2**(1/2))
import math
a,b,h,m = map(int,input().split())
x = 30*h
y = 6*m
if x > y:
  t = math.cos(math.radians(x-y))
else:
  t = math.cos(math.radians(y-x))
c = ((a**2) + (b**2) - 2 * a * b * t)**0.5
print(c)
import math
A,B,H,M = (int(x) for x in input().split())
if H == 0 :
    b = 6 * M
    if M >= 6:
        a = 360
    else:
        a = 0
elif M == 0 :
    a = (30 * H) + (30 * (M/60))
    if H >= 6:
        b = 360
    else:
        b = 0
else:
    a = (30 * H) + (30 * (M/60))
    b = 6 * M
c = abs(a-b)
s = math.sqrt(((A**2)+(B**2)-(2*A*B*(math.cos(math.radians(c))))))
if H == M:
    s = 0
print(s)
import math
A, B, H, M = map(int, input().split())
theta = abs((M/60)*math.pi*2-((H/12+M/720)*math.pi*2))
print((M/60)*math.pi*2)
print((H/12+M/720)*math.pi*2)
print(theta)
ans=A*A+B*B-(2*A*B*math.cos(theta))
ans=math.sqrt(ans)
print(ans)
##C
A,B,H,M = map(int,input().split())

##角度の計算
C=(H*30-M*6)*(H*30-M*6)
import math
ans = A**2 + B**2 -2*A*B*math.cos(math.radians(math.sqrt(C)))
print(math.sqrt(ans))
import math
A, B, H, M = map(int, input().split())
sd = H*30 + M*0.5
ld = M*6

c1 = 360 - ld - sd
c2 = sd - ld

if c1 > 0 and c1 < c2:
    ans = A**2 + B**2 - 2*A*B*math.cos(math.radians(c1))
else:
    ans = A**2 + B**2 - 2*A*B*math.cos(math.radians(c2))
print(f"{math.sqrt(ans):.10f}")
import math

a,b,h,m = map(int, input().split())
s = 30 * h + m/2 - 6 * m
lt = a * a + b * b - a * b * math.cos(math.radians(s))
l = math.sqrt(lt)
print(l)
import math

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

dig_h = (((h * 60) + m) / (12 * 60)) * 360 
dig_m = (m / 60) * 360
if dig_h - dig_m < 0:
    ans = dig_m - dig_h
    if ans > 180:
        ans = 360 - ans
elif dig_h - dig_m > 180:
    ans = 360 - dig_h - dig_m
else:
    ans = dig_h - dig_m

if ans == 0:
    len = 0.0
elif ans == 180:
    len = a + b
else :
    len = math.sqrt((a * a) + (b * b) - (2 * a * b * math.cos(math.radians(ans))))

print(len)
import math

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

d_h = (30 * h) + ((30 * m)/60)
d_m = (6 * m)

diff = abs(d_h - d_m)
if diff >= 180 :
    diff -= 180

d2 = (a ** 2) + (b ** 2) - (2 * a * b * math.cos((diff/180) * math.pi))

d = (d2 ** 0.5)

print(d)
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 = min(abs(long-short), abs(360-abs(short-long)))

print(math.sqrt(a**2+b**2+a*b*math.cos(math.radians(theta))))