while 1:
S1=input()
a=int(S1.split(":")[0])
b=int(S1.split(":")[1])
c=0
if S1=="0:00":
break
c=abs(float(0.5*(60*a+b)-6*b))
if c>180:
print("{:.3f}".format(360-c))
else:
print("{:.3f}".format(c))