a =  int(input())
b =  int(input())
c =  int(input())
d =  int(input())
e =  int(input())

a_syo = a//10
b_syo = b//10
c_syo = c//10
d_syo = d//10
e_syo = e//10
time1 = (a_syo + b_syo + c_syo + d_syo + e_syo) * 10

a_amari = a%10
b_amari = b%10
c_amari = c%10
d_amari = d%10
e_amari = e%10
lst = []
if a_amari == 0:
    pass
else:
    lst = lst + [a_amari]
if b_amari == 0:
    pass
else:
    lst = lst + [b_amari]
if c_amari == 0:
    pass
else:
    lst = lst + [c_amari]
if d_amari == 0:
    pass
else:
    lst = lst + [d_amari]
if e_amari == 0:
    pass
else:
    lst = lst + [e_amari]
#print (lst)
count = len(lst) - 1
#print (count)
lst.sort()
#print (lst)
time2 = (len(lst) -1)*10 + lst[0]
print (time1 + time2)