#! python3
# coding:utf-8

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


a_a = a%10
b_a = b%10
c_a = c%10
d_a = d%10
e_a = e%10

a_s = int(a/10) +1 
b_s = int(b/10) +1 
c_s = int(c/10) +1 
d_s = int(d/10) +1 
e_s = int(e/10) +1 

list=[a_a,b_a,c_a,d_a,e_a]
list2=[]
for i in range(len(list)):
    if not list[i] == 0:
        list2.append(list[i])
amari = min(list2)

kiriage = (a_a+b_a+c_a+d_a+e_a)*10
ans = amari + kiriage
print(ans)