import copy
T=[]
for i in range(5):
    T.append(int(input()))
t=[]
for i in range(5):
    t.append(T[i]%10)
a=0
if 0 not in t:
    for i in range(5):
        if t[i]!=min(t):
            a+=((T[i]//10)+1)*10
        if t[i]==min(t):
            a+=T[i]
if 0 in t:
    u=[i for i in t if i!=0]
    for i in range(5):
        if t[i]==0:
            a+=T[i]
        if t[i]!=0 and t[i]!=min(u):
            a+=((T[i]//10)+1)*10
        if t[i]!=0 and t[i]==min(u):
            a+=T[i]
print(a)