# n=[]
# c=[]
#
# for i in range(4):
#
# x,y=input().split()
# x=float(x)
# y=float(y)
# n.append(x)
# c.append(y)
# o=0
# for i in range(4):
# f=0
# x = (c[i]-n[i]) * 60
# o+=x
# if x<=60:
# continue
# elif x<=300:
# x+=x/20
# f+=x
#
# if o >= 900:
# f=f-f/20
# elif o > 240:
# x=240
# f+=x
# x=f//30*5000
#
# x=int(x)
#
# print(x)
t = 0
a=0
r=0
for i in range(4):
x,y=map(float,input().split())
t=y-x-1
if y-x<=1: # 일한시간이 1시간 이하면
continue
if t>=5:
t=4
a+=t
r+=t
print(r)
if a >= 15:
r=r-r/20
elif a<=5:
r=r+r/20
x=r*10000
x=int(x)
print(x)
#
# 3.0 -> 2.0
# 3.5 -> 2.5
# 4.0 -> 3.0
# 4.5 -> 3.5
# 5.0 -> 4.0
# 5.5 -> 4.0
# 6.0 -> 4.0
3회 조회

