peterverebics/CodeNet_Python_118 huggingface dataset:
K = int(input())
S = input()
ans = ""
if K >= len(S):
    print(S)
else:
    for i in range(K):
        ans += S[i]
    print(ans + "…")
K = int(input())
S = input()

if len(S) <= K:
  print(S)
else:
  print(S[:]+'...')
k = int(input())
s = input()

if len(s) < k:
    print(s)
else:
    print(s[0:k]+'...')
import sys
k = int(sys.stdin.readline().rstrip())
s = sys.stdin.readline().rstrip()
l = len(s)
if l < k:
  print(s)
else:
  print(s[:k] + "...")
K=int(input())
S=str(input())
if len(S) <= K:
    print(S)
elif len(S) > K:
    print(S[0:int(K)])
K=int(input())
S=list(input())

if (len(S)+1) <= K:
    print(S)
else:
    print(S[0:K:1],"...")
import sys

count = 0
for i in sys.stdin:
    if count == 0:
        K = int(i)
        count += 1
    else:
        S = i
length = len(S)
if length <= K:
    print(S)
else:
    print(S[0:K] + "…")
K = int(input())
S = input()

if(len(S)<=K):
    print(S)
else:
    print(S[0:K-1] + "...")
K = int(input())
S = input()
print(S if (len(S) > K) else (S[:K] + "..."))
k = int(input())
s = input()
if len(s) <= k:
    print(s)
else:
    print(s[:7] + '...')
K = int(input())
S = input()
print(S[:7]+'...')
import math
a, b, h, m = map(int,input().split())
ms = m//60
ma = m%60
h = h + ms
ha =h%12 + ma/60
rh = ha*math.pi/6
rm = ma*math.pi/30
x = math.cos(rh - rm)
ans = math.sqrt(a**2 + b**2 - 2*a*b*x)
print(ans)
import math
A, B, H, M = map(int, input().split())

long = H * 30 + M * 0.5
short = M * 6
angle = abs(long-short)
if angle > 180:
  angle = 360 - angle
  
ans = A**2 + B**2 - 2*A*B*math.cos(math.radians(angle))
ans = (ans) ** (1/2)
print(ans)
A,B,H,M = map(int, input().split())
import math
Hrad = H*math.pi*2/12 + M*math.pi*2/(60*12)
Mrad = M*math.pi*2/60
theta = abs(Hrad - Mrad)
print(math.sqrt(A**2 + B**2 -2*A*B*math.cos(theta)))
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(math.sqrt(a ** 2 + b ** 2 - 2 * a * b * math.cos(r)))
import math

a,b,h,m = input().split()
a,b,h,m = int(a),int(b),int(h),int(m)
asin = a * math.sin(math.radians(90-30*h-0.5*m))
acos = a * math.cos(math.radians(90-30*h-0.5*m))
bsin = b * math.sin(math.radians(90-6*m))
bcos = b * math.cos(math.radians(90-6*m))
d = math.sqrt((asin - bsin)**2 + (acos - bcos)**2)
print(d)
import math
A,B,H,M = map(int,input().split())
tmp_a = ((H%12)*30+0.5*M)%360
tmp_b = 6*M
tmp = abs(tmp_a-tmp_b)
r_2 = A**2 + B**2 -2*A*B*math.cos(math.radians(tmp))
print(math.sqrt(r_2))
import math 
A,B,H,M = map(int, input().split())

hour = H*0.5*60
mini = M*5.5
d = abs(hour-mini)
ans = A**2 + B**2 - 2 * A * B * math.cos(math.radians(d))
print(math.sqrt(ans))
import math

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

H %= 12

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

rad = deg*math.pi / 180

print((A**2 + B**2 - 2*(A*B*math.cos(rad)))**0.5)
#!/usr/bin/env python3
import sys
import collections
import math

sys.setrecursionlimit(10 ** 7)

# 1 ✕ N
A, B, C, D = list(map(int, input().rstrip().split()))
ar = (360 / 12) * C + D * 0.5
br = (360 / 60) * D

print(math.sqrt(A * A + B * B - (2 * A * B * math.cos(math.radians(abs(ar - br))))))
import math

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

thetaA =  math.radians(0.5*(60*H+M))
thetaB = math.radians(6*M)

Ax = A*math.cos(thetaA)
Ay = A*math.sin(thetaA)

Bx = B*math.cos(thetaB)
By = B*math.sin(thetaB)

dis = math.sqrt(pow(Ax-Bx,2) + pow(Ay-By,2))
print(dis)
import numpy as np
a,b,h,m=map(int,input().split())
pi = np.pi
x = 2*pi*(h*60+m)/720
y = 2*pi*m/60
theta=abs(x-y)
cos = np.cos(theta)
ans = (a**2+b**2-2*a*b*cos)**0.5
print(ans)
import math as mt
a, b, h, m = map(int, input().split())
hd = h*30
md = m*6
hd += md/12
d = abs(hd - md)
cd = mt.cos(d* mt.pi/180)
print(round(mt.sqrt(a*a + b*b - 2*a*b*cd), 20))
#C
import math
a,b,h,m = map(int,input().split())
#時間t(hour)
t = h + m/60
#a,bの角度
a_theta = t * 30
b_theta = (t * 360) % 360

theta = abs(a_theta - b_theta)

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

print(c)
a,b,h,m=map(int,input().split())
# Pythonで三角関数は単位をradiansにしてから
from math import cos,radians
# 時針Aの角度は1時間で30°、分数を加味してh*30°+30°*m/60
# 分針Bの角度は1分で6°、m*6°
theta = abs(m*6 - (h*30 + m / 2))
# 余弦定理 c**2 = a**2 + b**2 - 2abcosθ
print((a**2 + b**2 - 2*a*b*cos(radians(theta)))**0.5)
import math
A,B,H,M=list(map(int,input().split()))
move = 60*H+M
a_move = math.radians(move/720*360)
b_move = math.radians(M/60*360)

ax = A*math.cos(a_move)
ay = A*math.sin(a_move)
bx = B*math.cos(b_move)
by = B*math.sin(b_move)

ans = math.sqrt(math.pow(ax-bx,2) + math.pow(ay-by,2))
print(ans)
import math

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

theta_m = (math.pi * 2 * (M/60)) 
theta_h = (math.pi * 2 * (H/12)) + (math.pi/6 * (M/60))

theta = abs(theta_h - theta_m)

Ax, Ay = A *  math.cos(theta), A * math.sin(theta)
Bx, By = B, 0.0

print(math.sqrt(((Ax - Bx) ** 2) + ((Ay - By) ** 2)))
from math import pi, cos, sin, sqrt

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

A_th = ((H / 12) + (M / 60) / 12) * 2 * pi
B_th = (M / 60) * 2 * pi
A_x, A_y = A * cos(A_th), A * sin(A_th)
B_x, B_y = B * cos(B_th), B * sin(B_th)

print(sqrt(((A_x - B_x) ** 2 + (A_y - B_y) ** 2)))
import math

a, b, h, m = map(int, input().split())
o = 0
c = (h*30) + (m/60*30) - (m*6)
c = math.radians(c)
print(((a**2)+(b**2)-2*a*b*(math.cos(c)))**(1/2))
import math

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

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

p, q = max(H, M), min(H, M)
r = min(p-q, (360-p)+q)
c = round(math.radians(r), 40)
l = A ** 2 + B ** 2 - 2 * A * B * math.cos(c)
print(math.sqrt(l))
import numpy as np
a, b, h, m = map(int, input().split())
m_v = 6
h_v = 0.5

time = h * 60 + m
h_pos = time * h_v
m_pos = m * m_v

rad = abs(min((min(h_pos, m_pos)+360)-max(h_pos, m_pos), max(h_pos, m_pos)- min(h_pos, m_pos)))
rad = rad / 180 * np.pi

ans = (a**2 + b**2 - 2*a*b*np.cos(rad))**0.5
print(ans)
import math
A,B,H,M=map(int,input().split())
R1=(H*60+M)*(0.5)
R2=M*6
R=R1-R2
R=abs(R)
if(R>180):
  R=360-R
COS=math.cos(math.radians(R))
ans=A**2+B**2-2*A*B*COS
print(ans**(1/2))
import math
import sys

stdin = sys.stdin

ns = lambda: stdin.readline().rstrip()
ni = lambda: int(stdin.readline().rstrip())
nm = lambda: map(int, stdin.readline().split())
nl = lambda: list(map(int, stdin.readline().split()))
mod = 10**9 + 7 
sys.setrecursionlimit(1000010)


A,B,H,M = nm()
(a, b, h, m)=map(float,(A,B,H,M))

theta = 2.0 * math.pi * ( m /60.0 - (h + m /60.0 )/12.0)
print(math.sqrt( a * a + b * b - 2.0 * a * b * math.cos(theta)))
import math
a, b, h, m = map(int, input().split())

long = 360 * h / 12 + 360 / 12 * m / 60
short = 360 * m / 60
# long *= math.pi / 180
# short *= math.pi / 180
if True:
    theta = abs(long - short) * math.pi / 180
    B = a * math.cos(theta) - b
    A = a * math.sin(theta)
    print(math.sqrt(A*A + B*B))
from math import cos, radians

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

hs = 360 * h / 12 + 30 * m / 60
ms = 360 * m / 60

c = (
    max(hs, ms) - min(hs, ms)
    if max(hs, ms) - min(hs, ms) <= 180
    else 360 - (max(hs, ms) - min(hs, ms))
)
c = radians(c)
ans = (a ** 2 + b ** 2 - (2 * a * b * cos(c))) ** (1 / 2)
print(ans)
from math import pi, sin, cos, sqrt

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

x1 = A * cos(2 * pi * (H + M / 60) / 12)
y1 = A * sin(2 * pi * (H + M / 60) / 12)
x2 = B * cos(2 * pi * M / 60)
y2 = B * sin(2 * pi * M / 60)

print(sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2)))
import numpy as np
import math
A, B, H, M = map(int, input().split())

#K = int(input())
#S = input()

def yogen_teiri(A, B, ang):
    lenAB = np.sqrt(A**2 + B**2 - 2*A*B*math.cos(math.radians(ang)))
    return lenAB

angA = H*30+M*0.5
angB = M*6

if angA > angB:
    angAB = min(angA-angB, 360-(angA-angB))
    lenAB = yogen_teiri(A, B, angAB)
elif angB > angA:
    angAB = min(angB-angA, 360-(angB-angA))
    lenAB = yogen_teiri(A, B, angAB)
else:
    lenAB = np.abs(A-B)

print(lenAB)
import math


def main():
    a, b, h, m = [int(e) for e in input().split()]

    ht = (h/12 + m/720) * 2 * math.pi
    mt = (m/60) * 2 * math.pi
    theta = min(abs(ht - mt), 2 * math.pi - abs(ht - mt))

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


if __name__ == '__main__':
    main()
from math import cos, pi, sqrt

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

th = 2 * pi * (h / 12) + (2 * pi / 12) * (m / 60)
tm = 2 * pi * (m / 60)

answer = sqrt(a ** 2 + b ** 2 - 2 * a * b * cos(th - tm))
print(answer)
import math

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

h_hand = (m+(h*60))*0.5
m_hand = m*6

degree = abs(h_hand - m_hand)

cos_x = math.cos(math.radians(degree))

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

print(math.sqrt(sq))
import math

a = list(map(int,input().split()))
A = a[0]
B = a[1]
H = a[2]
M = a[3]
x = math.sqrt(A*A + B*B - 2*A*B*math.cos(math.radians(6*M - 30*H -  0.5*M)))
print(x)
import math
a, b, h, m = map(int, input().split())
alpha = 30.0 * h + (30 * m / 60)
beta = m * 6.0
if alpha < beta:
    theta = beta - alpha
else:
    theta = alpha - beta
print(math.sqrt(a**2 + b**2 - 2 * a * b * math.cos(math.radians(theta))))
import math

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

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

rad = abs(h-m)
cosrad = math.cos(math.radians(rad))
c2 = a**2 + b**2 - 2*b*a*cosrad
c2 = c2 ** 0.5

print(c2)
#C
import math

A,B,H,M = map(int,input().split())
a2 = A*A+B*B-2*A*B*math.cos(math.pi*2*((H/12+M/720)-M/60))
print(math.sqrt(a2))
import numpy as np

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

def get_angle(h,m):
    long_angle=2*np.pi*m/60
    short_angle=2*np.pi*h/12+(2*np.pi/12)*m/60
    big_angle=max(long_angle,short_angle)
    small_angle = min(long_angle, short_angle)
    angle=min(big_angle-small_angle,2*np.pi-big_angle+small_angle)
    return angle

def yogen(a,b,theta):
    ans=a**2+b**2-2*a*b*np.cos(theta)
    return ans**0.5

print(yogen(a,b,get_angle(h,m)))
import math
A,B,H,M = map(int,input().split())

edge = max(30*H+0.5*M,6*M) - min(30*H+0.5*M,6*M)
C = math.cos(math.radians(edge))
ans = math.sqrt(pow(A,2) + pow(B,2) - 2 * A * B * C)
print(ans)
A,B,H,M=map(int,input().split())
import math
k=math.cos(math.pi*((H/6)-((11*M)/360)))
L=(A**2+B**2-2*A*B*k)**0.5
print(L)
import numpy as np

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

def rot(deg):
    theta = np.radians(deg)
    c,s = np.cos(theta),np.sin(theta)
    return np.array([[c,-s],[s,c]])

print(np.linalg.norm(A*rot((H*60+M)*360/(60*12)).dot([[0],[1]]) - B*rot(M*360/60).dot([[0],[1]])))
from cmath import rect, pi

def deg_to_rad(deg): return deg * pi / 180

a, b, h, m = map(float, input().split())
zh = rect(a, deg_to_rad((60*h+m) / 2))
zm = rect(b, deg_to_rad(m * 6))
print(abs(zh-zm))
import math 
A, B, H, M = map(int,input().split())

timeHr = H + (M / 60)
angVelA = (1/6) * 180
angVelB = (2) * 180

degA = (angVelA * timeHr)
degB = (angVelB * timeHr) 

degDiff = math.radians(abs(degB - degA))

disX_2 = math.pow(B, 2) + math.pow(A, 2) - (2 * A * B * math.cos(degDiff))
disX = math.sqrt(disX_2)

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

hrad = h * 30 + m * 0.5
mrad = m * 6

l = math.sqrt(a**2 + b**2 - 2 * a * b * math.cos(math.radians(abs(hrad - mrad))))
print(l)
import math
a, b, h, m = map(int, input().split())
angle = abs(30*h - 5.5*m)
distance = (a*a + b*b - 2*a*b*math.cos(math.radians(angle)))
print(math.sqrt(distance))
from math import cos, pi, sqrt

a, b, h, m = map(float, input().split())
x = 30 * (h + m / 60)
y = 360 * m / 60
z = abs(x - y)
z = min(z, 360 - z)
print(sqrt(a * a + b * b - 2 * a * b * cos(pi * z / 180)))
import math
a, b, h, m = list(map(int, input().split()))
theta = abs(30 * h + (30 / 60 * m) - 6 * m)
theta = math.radians(min(360 - theta, theta))
print((b ** 2 + a ** 2 - 2 * b * a * math.cos(theta)) ** 0.5)
from math import pi, sin, cos, sqrt
a,b,h,m=map(int,input().split())
c=2*pi/12*h + pi/6/60*m
d=2*pi/60*m
ax=a*cos(c)
ay=a*sin(c)
bx=b*cos(d)
by=b*sin(d)
print(sqrt((ax-bx)**2 + (ay-by)**2))
import math
a,b,h,m = map(int,input().split())
ans = math.sqrt((a*math.cos((math.pi/6)*(h+m/60))-b*math.cos(2*math.pi*(h+m/60)))**2+(a*math.sin((math.pi/6)*(h+m/60))-b*math.sin(2*math.pi*(h+m/60)))**2)
print(ans)
import math

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

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

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

print(ans)
import sys
sys.setrecursionlimit(100000000)
MOD = 10 ** 9 + 7
INF = 10 ** 15
dy = (-1,0,1,0)
dx = (0,1,0,-1)
from math import radians,cos

def main():
    a,b,H,M = map(int,input().split())
    H *= 30
    H += M/2
    M *= 6
    x = min(360-abs(H - M),abs(H-M))
    x = radians(x)
    ans = a*a + b*b - 2*a*b*cos(x)
    print(ans**0.5)
if __name__ == '__main__':
    main()
import math

A, B, H, M = map(int, input().split())
a = 30*H+0.5*M
b = 6*M
kaku = abs(a-b)
if kaku > 180:
    kaku = 360-kaku
#print(kaku)
#print(math.cos(math.radians(kaku)))
ans = A*A+B*B-2*A*B*math.cos(math.radians(kaku))
print(math.sqrt(ans))
import math
A,B,H,M=map(int,input().split())
C2=A**2+B**2-2*A*B*math.cos((30*H-11*M/2)/180*math.pi)
print(C2**(1/2))
from math import pi, cos, sqrt

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

rad = abs((h+(m/60))/12 - m/60)*pi*2
c = sqrt(a**2 + b**2 - 2*a*b*cos(rad))

print(c)
import math
a,b,h,m=map(int,input().split())
kak=abs(6*m-(h+m/60)*30)
#print(kak)
kakok=math.radians(kak)
#print(kakok)
ans=(a**2+b**2-2*a*b*math.cos(kakok))**0.5
print(ans)
A,B,H,M = map(int,input().split())
# 角度
import math
Ar=H*30+M*0.5
Br=M*6
l=(A**2+B**2-2*A*B*math.cos(math.radians(abs(Ar-Br))))**0.5
print(l)
import math

def main():
    A,B,H,M = [int(x) for x in input().split()]
    degH = (0.5*H*60 + 0.5*M)
    degM = 6*M
    theta = abs(degH-degM)
    if theta == 180:
        print(A+B)
        return
    if theta > 180:
        theta = 180 - (theta - 180)
    # print(degH,degM,theta)
    # print(math.cos(math.radians(theta)))
    print(math.sqrt(A**2 + B**2 - 2*A*B*math.cos(math.radians(theta))))

if __name__ == '__main__':
    main()
import math
a, b, h, m = map(int, input().split())
x = (11 * m - 60 * h) * math.pi / 360
y = math.sqrt(a ** 2 + b ** 2 - 2 * a * b * math.cos(x))
print(y)
import math
buf = input().split(" ")
A=int(buf[0])
B=int(buf[1])
H=int(buf[2])
M=int(buf[3])


#omega_min = 360/3600
#omega_hour = 360 / (3600*12)
#theta_min = omega_min*M*60
#theta_hour = omega_hour*H*3600 + M/60/12

"""
if H*5 > M:
  rad = math.radians(theta_hour-theta_min)
else:
  rad = math.radians(theta_min-theta_hour)
"""
rad=math.pi*2 *(H / 12.0 + (M / 60.0) / 12.0 - M / 60.0)
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())
b=2*math.pi*(M/60)
a=2*math.pi*((H/12) + (M/(60*12)))
t=abs(a-b)
if t>math.pi:
  t=2*math.pi-t
print(math.sqrt(A**2+B**2-2*A*B*math.cos(t)))
from math import sqrt, cos, radians

def solve(A, B, H, M):
    Hr = (H * 60 + M) * 0.5
    Mr = M * 6
    r = abs(Hr - Mr)
    if r > 180:
        r = 360 - r

    if r == 90:
        print(sqrt(A ** 2 + B ** 2))
    else:
        print(sqrt(A ** 2 + B ** 2 - (2 * A * B * cos(radians(r)))))

A, B, H, M = map(int, open(0).read().split())
solve(A, B, H, M)
if __name__ == '__main__':
    from sys import stdin
    # from collections import defaultdict
    # from collections import deque
    # from collections import Counter
    # import numpy as np
    import math
    # import random
    input = stdin.readline

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

    total_minutes = 60*h + m
    h_degree = total_minutes*0.5
    m_degree = 6*m
    difference = h_degree - m_degree
    if difference > 180:
        difference = 360 - difference
    print((a**2+b**2-2*a*b*math.cos(math.radians(difference)))**0.5)
import math

a,b,h,m = map(float, input().split())
theta1 = (h*60 + m)/2
theta2 = m*6
theta = theta1 - theta2
c = math.sqrt(a**2 + b**2 - 2*a*b*math.cos(math.radians(theta)))
print(c)
import math

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

Md = M * 360 / 60
Hd = H * 30 + M * 30 / 60

MHd = abs(Md - Hd)

if MHd > 180 :
    MHd = 360 - MHd

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

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

max_int = 1000000001  # 10^9+1
min_int = -max_int

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

alpha = abs(math.pi * (h / 6 + m / 360 - m / 30))
if alpha > math.pi:
    alpha = 2 * math.pi - alpha

print((a ** 2 + b ** 2 - 2 * a * b * math.cos(alpha)) ** 0.5)
import math

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

ang_a = (h+m/60)/12
ang_b = m/60
ang = ang_a - ang_b if ang_a - ang_b <= 0.5 else ang_b - ang_a
theta = ang * 2 * math.pi
print(math.sqrt(a**2 + b**2 - 2*a*b*math.cos(theta)))
import math

data = input().split()
data = [int(i) for i in data]

short_x = data[0] * math.cos(math.radians(360 * (60 * data[2] + data[3]) /720))
short_y = data[0] * math.sin(math.radians(360 * (60 * data[2] + data[3]) /720))

long_x = data[1] * math.cos(math.radians(360 * (data[3]) / 60))
long_y = data[1] * math.sin(math.radians(360 * (data[3]) / 60))

print( math.sqrt((short_x - long_x) * (short_x - long_x) + (short_y - long_y) * (short_y - long_y)))
import math
A, B, H, M = map(int, input().split(' '))
deg = abs(30 * H + 0.5 * M - 6 * M)
if deg > 180:
    deg = 360 - deg
deg = math.radians(deg)
print(math.sqrt((B * math.sin(deg)) ** 2 + (B * math.cos(deg) - A) ** 2))
from math import sqrt, cos, radians
a, b, h, m = map(int, input().split())
x = h * 30
if m != 0:
    x += 30 / (60 / m)
y = m * 6
c = min(abs(x - y), 360 - abs(x - y))
#print(abs(x - y) % 180, 2 * a * b * cos(abs(x - y) % 180), cos(radians(abs(x - y) % 180)))
print(sqrt(a ** 2 + b ** 2 - 2 * a * b * cos(radians(c))))
a,b,h,m = map(int,input().split())
ans = 0
 
import math
 
rada = (2*math.pi/12)*(h+m/60)
radb = (2*math.pi/60)*m
 
if rada >= radb:
  theta = rada - radb
else:
  theta = radb - rada
  
if theta < math.pi:
  pass
else:
  theta = 2*math.pi - theta
 
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 = H*60 + M
a_rad = m / (60 * 12) * math.pi * 2
b_rad = M / 60 * math.pi * 2
ans = (A*A + B*B - 2*A*B*math.cos(a_rad-b_rad))**0.5
print(ans)
import math
A,B,H,M = map(int,input().split())
zi = 30*H + 0.5*M
hun = M*6
ans = (A**2 + B**2 - 2*A*B*math.cos(math.radians(abs(zi-hun))))**0.5
print(ans)
import math
A,B,H,M = map(int,input().split())

tmp = M * 0.5
if H == 0:
    H = 12
if M == 0:
    M = 60

h = H*30
m = (M/5)*30

if h >= m:
    rad = (h+tmp)-(m)
else:
    rad = (m)-(h+tmp)

ans = A**2 + B**2 - 2*A*B*(math.cos(math.radians(rad)))
print(ans**0.5)
import math

NUM = input().split()

A = float(NUM[0])
B = float(NUM[1])
H = float(NUM[2])
M = float(NUM[3])

rad_A = H * 2*math.pi / 12. + M * 2*math.pi / 12. / 60.
rad_B = M * 2*math.pi / 60.

X_A = A * math.cos(rad_A)
Y_A = A * math.sin(rad_A)
X_B = B * math.cos(rad_B)
Y_B = B * math.sin(rad_B)

D = math.sqrt((X_A - X_B)**2. + (Y_A - Y_B)**2.)

print(D)
def mp(): return map(int, input().split())
def lmp(): return list(map(int, input().split()))

import math
a,b,h,m = mp()
hkaku = h*30+m*0.5
mkaku = m*6
cos = math.cos((mkaku-hkaku)*math.pi/180)
u = a**2+b**2-2*a*b*cos
print(math.sqrt(u))
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)
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())


deg_h = 0.5 * (60 * H + M)
deg_m = 6 * M
rad_h = math.radians(deg_h)
rad_m = math.radians(deg_m)

theta = abs(rad_h - rad_m)
c2 = (A ** 2) + (B ** 2) - (2 * A * B * math.cos(theta))
print(math.sqrt(c2))
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 math


hour_hand_speed = (2 * math.pi) / (12 * 60)
minute_hand_speed = (2 * math.pi) / 60

hour_hand, minute_hand, hour, minute = list(
    map(int, input().split())
)

elapsed_time = 60 * hour + minute

hour_hand_angle = elapsed_time * hour_hand_speed
minute_hand_angle = minute * minute_hand_speed

angle_btw_hour_minute = abs(hour_hand_angle - minute_hand_angle)

distance = math.sqrt(
    hour_hand**2 + minute_hand**2 - (2 * hour_hand * minute_hand * math.cos(angle_btw_hour_minute))
)

print(distance)
import math

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

degree_h = ((H + M / 60) * 30) % 360
degree_m = ((H * 60 + M) * 6) % 360

deg = (
    min(abs(degree_h - degree_m), 360 - abs(degree_h - degree_m)) * 2 * (math.pi / 360)
)

print(math.sqrt(A ** 2 + B ** 2 - 2 * A * B * math.cos(deg)))
import sys
input = lambda: sys.stdin.readline().rstrip()
import math

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

cos = math.cos(math.radians(6 * M - 0.5 * (H * 60 + M)))

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

#時針の角度
Ha = (H * 360 / 12) + (30 * M/60)
#分針の角度
Ma = M * 360 / 60
#時針と分針のなす角度
a = abs(Ha-Ma)
#aのコサイン
cosa = math.cos(math.radians(a))

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

print(ans)
import math

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

time = h*60 + m
ji = math.radians(time*0.5)
hun = math.radians(m*6)

ax = a*math.sin(ji)
ay = a*math.cos(ji)
bx = b*math.sin(hun)
by = b*math.cos(hun)

ans = math.sqrt((ax-bx)**2 + (ay-by)**2)

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

c1 = (H/12+M/(60*12))*360
c2 = (M/60)*360

th = min(abs(c1-c2),abs(360-(c1-c2)))
th = (th / 180) * math.pi
print(math.sqrt((A**2)+(B**2)-2*A*B*math.cos(th)))
import sys
import math

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

cA = 360*H/12 + 30 * M/60
cB = 360*M/60
cC = abs(cA - cB)
if cC > 180:
    cC = 360 - cC

coscC = math.cos(math.radians(cC))
C = A**2 + B**2 - 2 * A*B*coscC

print(C**(1/2))
import math
a, b, H, M=map(int,input().strip().split())
H %= 12

short = M*6
long = (H*60+M)/2.0
dif = abs(short-long)
kakudo = min(dif,360-dif)

c = a*a + b*b - 2*a*b*(math.cos(math.radians(kakudo)))
d = math.sqrt(c)
print(d)
A,B,H,M = map(int,input().split())
import math
# 角度を求める
#長針
m = 6*M
#短針
h = (H * 30) + ((30/60)*M)
#最終角度
kakudo = min(360 - abs(m - h), abs(h - m))
kakudo_a = math.radians(kakudo)
cos_x = math.cos(kakudo_a)
 
c = A**2 + B**2 - 2*A*B*cos_x
print(math.sqrt(c))
import math

a, b, h, m = map(float, input().split(" "))
arg_a = 2 * math.pi * (h + m / 60) / 12
arg_b = 2 * math.pi * m / 60
arg = min(abs(arg_a - arg_b), 2 * math.pi - abs(arg_a - arg_b))
"""
print(str(arg_a / (math.pi * 2) * 360)
      + " "
      + str(arg_b / (math.pi * 2) * 360))
print(str(arg_a) + " " + str(arg_b))
print(arg / (math.pi * 2) * 360)
"""
length = math.sqrt((a*a + b*b) - (2*a*b * math.cos(arg)))
print(length)
def rs(): return input().strip()
def ri(): return int(input())
def ria(): return list(map(int, input().split()))
def ia_to_s(a): return ' '.join([str(s) for s in a])


import math


def solve(a, b, h, m):
    h_a = 90 - 360 / 12 * (m / 60 + h)
    m_a = 90 - 360 / 60 * m
    angle = m_a - h_a

    return (a*a + b*b - 2*a*b*math.cos(angle*math.pi/180))**0.5



def main():
    a, b, h, m= ria()
    print(solve(a, b, h, m))


if __name__ == '__main__':
    main()
import math
import decimal
xh = 0
yh = 0
xm = 0
ym = 0

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

th = (h*60+m)/720*2*math.pi
tm = (m)/60*2*math.pi

xh = (a)*math.cos(th)
yh = (a)*math.sin(th)
xm = b*math.cos(tm)
th = b*math.sin(tm)

x = abs(xh-xm)
y = abs(yh-th)
ans = math.sqrt(x**2+y**2)
print(format(ans, '.9f'))
import math
from decimal import Decimal
A, B, H, M = map(int, input().split())
theta = abs(11/2*M - 30*H)
rad = math.radians(theta)
cos = Decimal(math.cos(rad))
ans = math.sqrt(A**2 + B**2 - 2 * A * B * cos)
print("{:.020f}".format(ans))
import math
a, b, h, m = map(int, input().split())
rh = (h * 60 + m) / 720 * 2 * math.pi
rm = m / 60 * 2 * math.pi
if abs(rh - rm) < 180:
    r = abs(rh - rm)
    c = ((a ** 2) + (b ** 2) - (2 * a * b * math.cos(r))) ** 0.5
    print(c)
if abs(rh - rm) > 180:
    r = 360 - abs(rh - rm)
    c = ((a ** 2) + (b ** 2) - (2 * a * b * math.cos(r))) ** 0.5
    print(c)
if abs(rh - rm) == 180:
    print(a + b)
import math

a, b, h, m = list(map(int, input().split()))
deg_a = (60 * h + m) * (360 / (60 * 12))
deg_b = m * (360 / 60)
deg = abs(deg_a - deg_b)
rad = math.radians(deg)

c2 = a ** 2 + b ** 2 - 2 * a * b * math.cos(rad)
print(c2 ** 0.5)