peterverebics/CodeNet_Python_118 huggingface dataset:
import math

a, b, h, m = map(int, input().split())
h_rad = (h * 60 + m) * math.pi / 360
m_rad = m * math.pi / 30
cosine = math.cos(abs(h_rad - m_rad))

print(math.sqrt(a ** 2 + b ** 2 - 2 * a * b * cosine))
import math
A, B, H, M = map(int, input().split())
HT =  30*H + 0.5*M
MT = 6*M

ax = A*math.cos(math.radians(HT))
ay = A*math.sin(math.radians(HT))
bx = B*math.cos(math.radians(MT))
by = B*math.sin(math.radians(MT))

d = math.sqrt(abs(ax-bx)**2 + abs(ay-by)**2)
print(d)
import math
a,b,h,m = map(int, input().split())

h_angle = 30*h + 0.5*m
m_angle = 6*m
diff_angle = abs(h_angle - m_angle)

if diff_angle > 180:
    diff_angle = 360 - diff_angle

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

a, b, h, m = map(int, input().split())
theta = abs(6 * m - ((h*60)+m)*0.5)
theta = min(360-theta, theta)
ans = math.sqrt(a**2 + b**2 - 2 * a * b * math.cos(math.radians(theta)))
print(ans)
import math

a,b,h,m = map(int,input().split())
d = abs(30*h+0.5*m-6*m)
c = math.sqrt(a**2+b**2-2*a*b*math.cos(math.radians(d)))
print(c)
import math
A, B, H, M = map(int, input().split())
angle = abs((H*30 + M*0.5) - M*6)%360
print(math.sqrt(A**2 + B**2 - 2*A*B*math.cos(angle*math.pi/180)))
import math
a,b,h,m=map(int,input().split())
h=h%12
m=m%60
deg_a=2*math.pi*(h/12+m/720)
deg_b=2*math.pi*m/60
distance=a**2+b**2-2*a*b*math.cos(deg_a-deg_b)
print(math.sqrt(distance))
import math
a,b,h,m = map(int,input().split())

short_time = (h * (360 / 12) + m * 0.5)
long_time = m * (360 / 60)


kakudo = abs(long_time - short_time)

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())

ka_a = ((H/12) * 360) + (30*(M/60))
ka_b = M/60 * 360

kakudo = max(ka_a, ka_b) - min(ka_a, ka_b)
kakudo = min(kakudo, (360-kakudo))
cos = math.cos(math.radians(kakudo))

if kakudo==180:
    print(A+B)
    exit()

ans = A**2 + B**2 - 2*A*B*cos

print(math.sqrt(ans))
import math
from decimal import Decimal
a, b, H, M = map(Decimal, input().split())

H = (H/Decimal(12) + M/Decimal(720))*Decimal(math.pi)*Decimal(2)
M = (M/Decimal(60))*Decimal(math.pi)*Decimal(2)
c = a**Decimal(2)+b**Decimal(2)-a*b*Decimal(2)*Decimal(math.cos(H-M))
print(math.sqrt(c))
import math
a,b,h,m=map(int,input().split())
#時針の角度
ho=(360/720)*(h*60+m)
#分の角度
mi=(360/60)*m
sita1=abs(mi-ho)
sita2=360-sita1
sita=min(sita1,sita2)
x=math.sqrt(a**2 + b**2 -2*a*b*math.cos(sita*math.pi/180))
print(x)
import math
a,b,h,m=map(int,input().split())
angle=abs(m/60-(h*60+m)/720)*360
angle=min(angle,360-angle)
print((a**2+b**2-2*a*b*math.cos(math.radians(angle)))**(1/2))
import cmath

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

A = param[0]
B = param[1]
h = param[2]
m = param[3]

v = (A*pow(cmath.e, (cmath.pi*m/30)*1j) - B*pow(cmath.e, (cmath.pi*h/6 + cmath.pi*m/360)*1j))

print(abs(v))
import sys
from math import cos, radians

sys.setrecursionlimit(10 ** 7)
rl = sys.stdin.readline


def solve():
    A, B, H, M = map(int, rl().split())
    
    rad_h = 0.5 * (60 * H + M)
    rad_m = M * 6
    rad = min(abs(rad_h - rad_m), abs(rad_m - rad_h))
    ans = ((A ** 2) + (B ** 2) - (2 * A * B * cos(radians(rad)))) ** 0.5
    print(ans)


if __name__ == '__main__':
    solve()
import math
from decimal import Decimal

a, b, h, m = map(int, input().split())
lon = 0.5 * m + 30 * h
sho = 6 * m
d = max(lon, sho) - min(lon, sho)
deg = min(d, abs(360-d))

f = lambda c: c if c <= 90 else 180 - c
rad = math.radians(f(deg))
y = Decimal(math.sin(rad))
x = Decimal(math.cos(rad))
if deg > 90:
    L = a + x * b
else:
    L = a - x * b
l = b * y

print("{:.9f}".format(Decimal(math.sqrt((l**2)+(L**2)))))
import math

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

ang = abs(h * 30 - m * 11/2)
angle = min(ang, 360-ang)

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

print(c)
import  math
A,B,H,M = list(map(int,input().split()))
short_nid_degree = H * 30 + (0.5 * M)
long_nid_degree = M * 360 /60
diff_nid_degree =  abs(short_nid_degree - long_nid_degree)
if diff_nid_degree > 180:
    diff_nid_degree=360 - diff_nid_degree
c_2  = A**2 + B**2 - (2 * B * A * math.cos(math.radians(diff_nid_degree)))
c= math.sqrt(c_2)
print(f"{c:.20f}")
import math
A,B,H,M=map(int, input().split())

HM=M/60
H=H+HM

H = H/12*360
M = M/60*360
cos = H-M

cos = math.cos(math.radians(cos))


ans = A**2+B**2-(2*A*B*cos)

print(math.sqrt(ans))
import math
A,B,H,M=map(int,input().split())
x=360*(H+M/60)/12-360*M/60
cos=math.cos(math.radians(x))
C = A**2 + B**2 - 2*A*B*(cos)
print(C**0.5)
import math
A,B,H,M=map(int,input().split())
a=360*H/12+360*M/60/12
b=360*M/60
c=abs(a-b)
if c>180:
    c=360-c
C=(A**2+B**2-(2*A*B*math.cos(math.radians(c))))**0.5
print(C)
import math

def calc(a, b, h, m):
    A = (h/12*360) + (m/60*30)
    B = m/60*360
    angle = abs(A-B)
    res = math.sqrt(a**2 + b**2 - 2*a*b*math.cos(math.radians(angle)))
    return res

a, b, h, m = map(int, input().split())
ans = calc(a, b, h, m)
print(ans)
import math
A, B, H, M = map(int, input().split())
theta = abs((M/60)*math.pi*2-((H/12+M/720)*math.pi*2))
ans=A*A+B*B-(2*A*B*math.cos(theta))
ans=math.sqrt(ans)
print(ans)
import math
 
date0=input().rstrip().split(" ")
A=int(date0[0])
B=int(date0[1])
H=int(date0[2])
M=int(date0[3])
P=(H+(M/60))*30
Q=M*6
if P>Q:
    R=P-Q
else:
    R=Q-P
if R>=180:
    R=360-R
print(math.sqrt(A**2+B**2-2*A*B*math.cos(math.radians(R))))
import math

pi = math.acos(-1)

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

s_ang = h * 30 + m * 0.5
l_ang = m * 6

ang = min(abs(s_ang - l_ang), 360-abs(s_ang-l_ang))

rad = math.radians(ang)

c = math.sqrt(pow(a, 2) + pow(b, 2) - 2*a*b*math.cos(rad))

if ang == 0:
    c = abs(a-b)
elif ang == 180:
    c = a+b
    
print('{:.10f}'.format(c))
import math
def main():
    a,b,h,m = map(int, input().split())
 
    ar = h * 360 / 12 + m * 30 / 60
    br = m * 360 / 60
    kakudo = x if (x := abs(ar-br)) < 180 else 360-x
    ans = a**2+b**2-2*a*b*math.cos(kakudo*math.pi/180)
    print(ans**0.5)
    
    # print(math.sqrt(ans))
if __name__ == "__main__":
    main()
import math

A, B, H, M = map(int, input().split())
hour = (H+M/60) / 12 * 360
minute = M / 60 * 360
deg=(max(hour, minute) - min(hour, minute)) % 360
if deg <= 180:
    pass
else:
    deg = 360 - deg

ans = math.sqrt(A**2 + B**2 -2*A*B*math.cos(deg * math.pi / 180))
print(ans)
import math
A, B, H, M = map(int, input().split())
pi = math.pi

ta = 30*H + 0.5*M
tb = 6*M

t = math.fabs( ta - tb )

if t > 180.0:
    t = 360.0 - t

#print(t)

t = (t*pi)/180.0

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

print("{:.9f}".format(math.sqrt(ans)))
#!/usr/bin python3
# -*- coding: utf-8 -*-

import math

def main():
    A, B, H, M = map(int, input().split())
    rda = math.radians(360*(60*H+M)/(60*12))
    rdb = math.radians(360*M/60)
    La = [A*math.cos(rda),A*math.sin(rda)]
    Lb = [B*math.cos(rdb),B*math.sin(rdb)]
    ret = (La[0]-Lb[0])**2 + (La[1]-Lb[1])**2
    ret = ret ** 0.5
    print(ret)

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

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

x = 360//12
y = 360//60

a = M*y
b = (H+M/60)*x
T = 1
if a>=b:
  if a-b>180:
    k = 360 - a+b
  elif a - b == 180:
    print(A+B)
    T = 0
  else:
    k = a-b
else:
  if b-a>180:
    k = 360 - b+a
  elif b-a == 180:
    print(A+B)
    T = 0
  else:
    k = b-a

if T == 1:
  k = math.radians(k)

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

  print(math.sqrt(ans))
import math
a,b,h,m= list(map(int,input().split()))
x = h*60 + m #分

theta_s = 0.5*x
theta_s = theta_s % 360
theta_l = 6.0*x
theta_l = theta_l % 360
theta_mean = abs(theta_l-theta_s)

if theta_mean > 180:
    theta_mean = 360 - theta_mean
c2 = a**2 + b**2 - 2*a*b*math.cos(theta_mean*math.pi/180) 
c = math.sqrt(c2)
print(c)
import math

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

long_angle=6*m
short_angle=(60*h+m)/2
angle=max(long_angle,short_angle)-min(long_angle,short_angle)
if angle>180:
    angle=360-angle

ans = 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())

minutes=H*60+M

A_angle=360*minutes/(12*60)
A_angle=A_angle%360
B_angle=M*6
A_rad=math.radians(A_angle)
B_rad=math.radians(B_angle)
dlt_rad=abs(A_rad-B_rad)
C=math.sqrt(A**2+B**2-2*A*B*math.cos(dlt_rad))
print(C)
import math
a, b, h, m = map(float, input().split())
h_rad = h/12.0*(2.0*math.pi) + (m/60.0)*(2.0*math.pi)/12.0
m_rad = m/60.0*(2.0*math.pi)
rad = abs(h_rad-m_rad)
print(math.sqrt(a**2+b**2-2*a*b*math.cos(rad)))
import math
a, b, h, m = list(map(float ,input().split(' ')))
pi = math.pi
x, y = pi*h/6 + m*pi/360, pi*m/30

res = math.sqrt(a**2 + b**2 - 2*a*b*(math.cos(x-y)))
print(res)
from cmath import exp
from math import radians


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

    # 針の位置をA(B) * ext(iθ)で複素数で定義しておく
    # expはmathモジュールでは無く、cmathモジュールを使わないとエラーになる
    h_hand = A * exp(radians((H % 12) * 30 + float(M) / 60.0 * 30.0) * 1j)
    m_hand = B * exp(radians(M / 60 * 360) * 1j)

    ans = abs(m_hand - h_hand)
    print(ans)


if __name__ == "__main__":
    main()
import math
x=input()
x0=x.split()
a=int(x0[0])
b=int(x0[1])
h=int(x0[2])
m=int(x0[3])
t1=float(math.pi*(h*60+m)/360)
t2=float(math.pi*m/30)
answer=math.sqrt((a*math.cos(t1)-b*math.cos(t2))**2+(a*math.sin(t1)-b*math.sin(t2))**2)
print(answer)
import math
A,B,H,M = map(int,input().split())

CC = ((H * 60 + M) * 0.5) - (M * 6)
cc = math.cos(math.radians(CC))
XX = A ** 2 + B ** 2 - 2 * A * B * cc
print(math.sqrt(XX))
a, b, h, m = [int(e) for e in input().split()]
import math

x = ((a*math.cos(math.pi/6*(h+m/60))-b*math.cos(math.pi/30*m))**2 + (a*math.sin(math.pi/6*(h+m/60))-b*math.sin(math.pi/30*m))**2 )**(1/2)

print(x)
import math
a,b,h,m = list(map(int,input().split()))
long = (h*60+m)/(12*60) * 360 * math.pi/180
short = m/60 * 360 * math.pi/180
h_x = math.cos(long) * a
h_y = math.sin(long) * a
m_x = math.cos(short) * b
m_y = math.sin(short) * b

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

a_theta = math.radians(30*h) + math.radians(m/60*30)
b_theta = math.radians(6*m)

a_x = a*math.cos(a_theta)
a_y = a*math.sin(a_theta)
b_x = b*math.cos(b_theta)
b_y = b*math.sin(b_theta)

d = math.sqrt((a_x - b_x)**2 + (a_y -b_y)**2)
print(d)
def resolve():
    import math

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

    theta = abs(((h + m/60)/12 - m/60) * math.pi * 2)
    if theta == 0:
        print(abs(a - b))
        return
    elif theta == math.pi:
        print(a + b)
        return
    theta = min(theta, 2 * math.pi - theta)
    cos_theta = math.cos(theta)
    c = math.sqrt((a ** 2) + (b ** 2) - (2 * a * b * cos_theta))
    print(c)
resolve()
import math
A,B,H,M=input().split()

A=int(A)
B=int(B)
H=int(H)
M=int(M)

kakudo_H = H*30 +M*0.5
kakudo_M = M*6
if M==0:
    kakudo_M=360

kakudo_sa=abs(kakudo_H-kakudo_M)
# cはまずは2条している値としてセット
c=A**2 +B**2-2*A*B*(math.cos(math.radians(kakudo_sa)))
C=c**0.5
print(C)
import math
a,b,h,m = map(int,input().split())
m_rad = (m * math.pi) / 30
h_rad = ((60*h+m)*math.pi)/360
rad = abs(h_rad -m_rad)
ans = math.sqrt(a**2+b**2-2*a*b*math.cos(rad))
print(ans)
import math

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

time = h * 60 + m

ta = time * 2 * math.pi / (12 * 60)
tb = time * 2 * math.pi / 60

xa = a * math.sin(ta)
ya = a * math.cos(ta)
xb = b * math.sin(tb)
yb = b * math.cos(tb)

ans = math.sqrt((xa-xb)**2 + (ya-yb)**2)
print(ans)
from math import *

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

deg1=30*h+0.5*m
deg2=6*m
c=a**2+b**2-2*a*b*cos(radians(deg1-deg2))

print(c**0.5)
import math
A,B,H,M = map(int,input().split())
A_rad_std = 0.5
B_rad_std = 6
minute = H*60 + M
A_rad = math.radians(A_rad_std * minute)
B_rad = math.radians(B_rad_std * M)

A_Xpoint = A * math.cos(A_rad)
A_Ypoint = A * math.sin(A_rad)
B_Xpoint = B * math.cos(B_rad)
B_Ypoint = B * math.sin(B_rad)

d = math.sqrt((A_Xpoint - B_Xpoint)**2 + (A_Ypoint - B_Ypoint)**2)
print(d)
import math
A, B, H, M = map(int, input().split())

hour_rad = (60 * H + M) / 720 * (2 * math.pi)
minute_rad = (M / 60) * (2 * math.pi)
theta = hour_rad - minute_rad

res = math.sqrt(A**2 + B**2 - 2 * A*B*math.cos(theta))
print(res)
import math
a,b,h,m=map(int,input().split())
h=h+m/60
htheta=h*math.pi/6
mtheta=m*math.pi/30
theta=abs(htheta-mtheta)
print(math.sqrt(a*a+b*b-2*a*b*math.cos(theta)))
import math

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

Hour_rad = H * 30
Hour_rad += M * 0.5

Min_rad = M * 6




rad = abs(Hour_rad - Min_rad)

if rad > 180:
    rad = 360 - rad

#Hour_redとMin_radが１８０度離れていたらコサインに１引いたものを代入する。



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

print(ans)
import math

lh, lm, h, m = (int(i) for i in input().split())
ang1 = 360 / 12 * h + (30 / 60) * m
ang2 = 360 / 60 * m
ang = abs(ang1 - ang2)
#print(ang)
ang = ang / 360 * 2 * math.pi
#print(ang)
sq = lh**2 + lm**2 - 2 * lh * lm * math.cos(ang)
print(math.sqrt(sq))
a,b,h,m = map(int,input().split())
time = 60*h + m
tansin = 1/2 * time
tyousin = 6 * m

do = min(abs(tansin - tyousin) , 360 - abs(tansin - tyousin))
import math
if do == 180:
  print(a + b)
else:
  c = math.sqrt(a**2 + b**2 - 2*a*b*math.cos(math.radians(do)))
  print(c)
def r2d(d):
    return d*360/2/math.pi

import math
a, b, h, m = map(int, input().split())
short = (h * (360 / 12)) + m * 1/2;

long = m * (360 / 60);

ang = abs(long - short);

ang = min(ang, (360 - ang))

res2 = a**2 + b**2 -2*a*b*math.cos(2*math.pi * (ang/360))

print(res2 ** 0.5)
from math import pi, cos, sin, sqrt

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

theta_a = 2*pi * (h*60 + m) / (12*60)
theta_b = 2*pi * m / 60

[xa, ya] = [a*cos(theta_a), a*sin(theta_a)]
[xb, yb] = [b*cos(theta_b), b*sin(theta_b)]

distance = sqrt((xa - xb)**2 + (ya - yb)**2)
print(distance)
a, b, h, m = list(map(int, input().split()))
import math
 
h = math.pi*(h+m/60)/6
m = math.pi*m/30
 
s = abs(h-m)
 
print(math.sqrt(a**2 + b**2 -2*a*b*math.cos(s)))
# coding: utf-8
# Your code here!
import sys,math
(A,B,H,M) = map(int,input().split())
print(A,B,H,M,file=sys.stderr)

# 2針の回転角度
rad1 = H*(30) + M*(0.5)
rad2 = M*(6)

# 内角
rad = abs(rad1 - rad2)
ans = 0

# 対辺の長さ
if rad == 180:
    ans = A+B
else:
    #rad = rad % 180
    ans = math.sqrt(A**2 + B**2 - 2*A*B*math.cos(math.radians(rad)))

print(rad1,rad2,rad,ans,file=sys.stderr)
print(ans)
import math
import pprint
import fractions
import collections
import itertools
A,B,H,M=map(int,input().split())
s1=0.5*(60*H+M)
s2=6*M
theta=min(abs(s1-s2),360-abs(s1-s2))
#print(theta)
print(math.sqrt(pow(A,2)+pow(B,2)-2*A*B*math.cos(math.radians(theta))))
from math import cos
from math import radians as rad
from math import degrees as dig
from math import sqrt as r

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

H_ = H * 30 + (M / 60 * 30)
M_ = M * 6

if abs(H_ - M_) < 180:
    HM_rad = rad(abs(H_ - M_))
else:
    HM_rad = rad(360 - abs(H_ - M_))

#print(dig(HM_rad))

ans = r(A ** 2 + B ** 2 - 2 * A * B * cos(HM_rad))
print(ans)
import math

A,B,H,M=(int(x) for x in input().split())
X=(A*math.cos(M*math.pi/30)-B*math.cos(H*math.pi/6+M*math.pi/360))**2
Y=(A*math.sin(M*math.pi/30)-B*math.sin(H*math.pi/6+M*math.pi/360))**2
L=math.sqrt(X+Y)
print(L)
import math

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

aa = h/6 * math.pi + (m/30 * math.pi)/12
bb = m/30 * math.pi
kakudo = max(aa, bb) - min(aa, bb)
x = a**2 + b**2 - 2*a*b*math.cos(kakudo)
print(math.sqrt(x))
from math import *
A,B,H,M=map(int,input().split())
dh=(H*60+M)/720
dm=M/60
d=min(abs(dh-dm),1-abs(dh-dm))*2*pi
print((A**2+B**2-2*A*B*cos(d))**.5)
from math import pi
from math import cos
from math import sqrt

A,B,h,m=map(int,input().split())

a=2*pi*(h/12+m/720)
b=2*pi*(m/60)
t=a-b

l=sqrt(A*A+B*B-2*A*B*cos(t))

print(l)
import numpy as np
a,b,h,m = map(int, input().split())

kaku_min = 6*m
kaku_hr = 30*h+0.5*m
delta = abs(kaku_min - kaku_hr)
kaku = min(360-delta, delta)
c = np.sqrt(a**2 + b**2 - 2*a*b*np.cos(np.pi*kaku/180))
print(c)
#!/usr/bin/env python
import sys
from math import sin, cos, pi, sqrt
import bisect
sys.setrecursionlimit(10 ** 9)
inf = float("inf")
readline = sys.stdin.buffer.readline
ns = lambda: readline().rstrip()
ni = lambda: int(readline().rstrip())
nm = lambda: map(int, readline().split())
nl = lambda: list(map(int, readline().split()))
nt = lambda: tuple(map(int, readline().split()))

def main():
    A, B, H, M = nm()
    theta1 = 2 * pi * (H / 12 + M / 720)
    theta2 = 2 * pi * M / 60

    ans = A ** 2 + B ** 2 - 2 * A * B * cos(abs(theta2 - theta1))
    print(sqrt(ans)) 


if __name__ == '__main__':
    main()
import math
A,B,H,M = (map(int , input().split()))
kado = min(360-abs(((H*5*6)+(M*(6/12)))-(M*6)) , abs(((H*5*6)+(M*(6/12)))-(M*6)))
print(((A**2) + (B**2) - ((2*A*B)*math.cos(math.radians(kado))))**0.5)
import math
if __name__ == "__main__":
    A, B, H, M = map(int, input().split())
    angle = 0
    small = (H * 60 + M) * 0.5
    big = M * 6
    if small > big:
        angle = small - big
    else:
        angle = big - small
    cos_c = math.cos(math.radians(angle))
    print(math.sqrt(A**2 + B**2 -(2*A*B*cos_c)))
import math
A, B, H, M = list(map(int, input().split()))
print(math.sqrt(A**2+B**2-2*A*B*math.cos(math.radians(30*H-11*M/2))))
import math
A, B, H, M = map(int, input().split())

H_deg = H*30 + M*0.5
M_deg = M*6
if M_deg <= H_deg:
    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


def get_theta(H, M):
    M_theta = math.pi / 30 * M
    H_theta = math.pi / 6 * (H + M / 60)

    return min(abs(M_theta - H_theta), 2 * math.pi - abs(M_theta - H_theta))

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

theta = get_theta(H, M)
print(((B*math.cos(theta) - A)**2 + (B*math.sin(theta))**2)**0.5)
import math
A,B,H,M = map(int, input().split())

t1 = math.pi*M/30
t2 = math.pi*(H/6 + M/360)

print(math.sqrt(A**2+B**2-2*A*B*math.cos(t2-t1)))
import sys
input = sys.stdin.readline
import numpy as np


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


p = np.pi
h_m = h * 60 + m

arg_min = 2 * p / 60 * m
arg_hor = 2 * p / 720 * h_m

the = float(abs(arg_min-arg_hor))

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

print(ans)
import math

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

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

print(r)
import math

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

r = abs(h*30-m*6+m/60*30)

if r >= 180:
    r = 360 - r

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

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

a_y = ((h/12)*360+m/(60*12)*360)%360
b_y = ((m/60)*360)%360

from math import *

alpha = ((a_y - b_y)%360)*pi/180

ans = sqrt(a**2+b**2-2*a*b*cos(alpha))

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

tanshin = 2 * math.pi * m / 60
choushin = 2 * math.pi * (60*h + m) / 720
difference = choushin - tanshin
c = math.sqrt(a**2 + b**2 - 2*a*b*math.cos(difference))
print(c)
import math

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

H_angle  = (H*30)+ (M/60)*30 #0時方向を0度としたときの角度
M_angle  = (M/60)*360
ab_angle = abs(M_angle-H_angle)
C_2 = A**2 + B**2 -2*A*B*math.cos(math.radians(ab_angle))
print(math.sqrt(C_2))
A,B,H,M = map(int,input().split())
minute = H * 60 + M
k1 = 360*minute/(12*60)
k2 = 360*minute/ 60
import math
c = math.cos(math.radians(max(k1-k2,k2-k1)))
print((A*A+B*B-2*A*B*c)**(1/2))
A, B, H, M = map(int, input().split())
#A = float(A)
#B = float(B)
#H = float(H)
#M = float(M)

import numpy as np

angle = 2*np.pi*H/12 - 2*np.pi*M*11/(12*60)
length_squared = A**2 + B**2 - 2*A*B*np.cos(angle)
length = np.sqrt(length_squared)
#print('{:10f}'.format(length))
# 4.56425719433005567605

print(length)
import sys
import math
input = sys.stdin.readline

a, b, h, m = map(int, input().split())
mm = m / 60 * 360
hh = h / 12 * 360 + m / 60 * 30
theta = min(abs(mm - hh), 360 - abs(mm - hh))
c = a * a + b * b - 2 * a * b * math.cos(theta * math.pi / 180)
print(c**0.5)
import math
A, B, H, M = map(int, input().split())

H_rad = (H*60+M)/(12*60)*360
M_rad = M/60*360

H_x = A*math.cos(math.radians(H_rad))
H_y = A*math.sin(math.radians(H_rad))
M_x = B*math.cos(math.radians(M_rad))
M_y = B*math.sin(math.radians(M_rad))

X = H_x - M_x
Y = H_y - M_y

print(math.sqrt(X*X+Y*Y))
import math
import cmath

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

a = cmath.rect(A, 2 * math.pi * ((H + M / 60) / 12))
b = cmath.rect(B, 2 * math.pi * (M / 60))

print(abs(a - b))
import math

a,b,h,m = map(int,input().split())
zisin = (360/12)*h
zisin += 0.5*m
if zisin == 0:
    zisin = 360
hunsin = (360/60)*m
if hunsin == 0:
    hunsin = 360

if zisin == hunsin:
    print(abs(a-b))
    exit()
elif zisin > hunsin:
    cosa = zisin-hunsin
else:
    cosa = hunsin-zisin
# print(cosa)
ans = (a**2)+(b**2)-2*a*b*math.cos(math.radians(cosa))
# print(math.cos(cosa),math.radians(cosa),math.cos(math.radians(cosa)),ans)
ans = math.sqrt(ans)
print(ans)
import math
from decimal import Decimal as dec

def main():
    a, b, h, m = map(int, input().split())
    hr = dec(360//12*(h%12)+30*(m%60)/60)
    mr = 360//60*(m%60)
    ans = dec(math.sqrt(a**2+b**2-2*a*b*dec(math.cos(dec(math.radians(abs(hr-mr)))))))
    print(ans)

if __name__ == "__main__":
    main()
import numpy as np

PI = 3.141592
P = 3.141592653589793238462643383279502884197169399
A, B, H, M = map(int, input().split())

A_ang = (30*H) + (0.5*M)
B_ang = 6 * M

angle = abs(A_ang - B_ang)
if angle > 180:
    angle = 360-angle

angle = (angle/360) * 2*P

a = (A*A) + (B*B) - (2*A*B*np.cos(angle))

a = np.sqrt(a)
print(a)
import sys; input = sys.stdin.buffer.readline
from collections import defaultdict
import math
con = 10 ** 9 + 7; INF = float("inf")

def getlist():
	return list(map(int, input().split()))

#処理内容
def main():
	A, B, H, M = getlist()
	x0 = A * math.cos(math.radians(30 * H + M * 0.5))
	y0 = A * math.sin(math.radians(30 * H + M * 0.5))
	x1 = B * math.cos(math.radians(6 * M))
	y1 = B * math.sin(math.radians(6 * M))
	ans = ((x1 - x0) ** 2 + (y1 - y0) ** 2) ** 0.5
	print(ans)

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

line=input().split()
line=[int(i) for i in line]
time=line[2]*60+line[3]
xhour=line[0]*math.cos((2*math.pi*time)/720)
yhour=line[0]*math.sin((2*math.pi*time)/720)
xmin=line[1]*math.cos((2*math.pi*time)/60)
ymin=line[1]*math.sin((2*math.pi*time)/60)
ans=math.sqrt(((xhour-xmin)**2)+((yhour-ymin)**2))
print(ans)
import math

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

hangle = h * 30 + m * 0.5
mangle = m * 6

angle = hangle - mangle

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

print(len)
import math 
a,b,h,m=map(int, input().split())
p=360*(h/12+m/(12*60))
q=360*(m/60)
if(p>=q):
    r=p-q
else:
    r=q-p
if(r>180):
    r=360-r
#print(p,q,r)
rad=math.radians(r)
cos=math.cos(rad)
c=a*a+b*b-2*a*b*cos
c2=math.sqrt(c)
#print(rad,cos,c)
print(f"{c2:.10f}")
import math

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

h_rad = 30*h
h_rad += m*0.5
m_rad = 6*m
diff1 = abs(h_rad-m_rad)

diff2 = 360-diff1

diff = min(diff1,diff2)


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

def main():
    a,b,h,m = map(int, input().split())
    hd = math.pi/6*h + math.pi/360*m
    md = math.pi/30*m
    print(math.sqrt(a**2+b**2-2*a*b*math.cos(hd-md)))


if __name__ == '__main__':
    main()
import math
from decimal import *
A,B,H,M = map(int,input().split())

h_rad = math.radians((30 * (H + M / 60)))
m_rad = math.radians(6 * M)
diff = abs(h_rad - m_rad)

ans = math.sqrt(pow(A,2) + pow(B,2) - 2 * A * B * math.cos(diff))

print(ans)
from math import pi, cos

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

h += m / 60

alpha = 2 * pi * abs(h / 12 - m / 60)

ans = (a ** 2 + b ** 2 - 2 * a * b * cos(alpha)) ** .5

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

#各針の回転角を求める
omega = H*60+M
tanshin = omega*0.5
choshin = omega*6 % 360
#print(tanshin,choshin)#それぞれの，その時間での角度も止まる
#print(max(tanshin,choshin)-min(tanshin,choshin)) 

shita = max(tanshin,choshin)-min(tanshin,choshin)
if shita > 180:
    shita = 360 - shita

#print(shita)
ans = math.sqrt(A**2+B**2-2*A*B*math.cos(math.radians(shita)))
print(ans)