def last_num(a):
    while a//10!=0:
        a=a%10
    return a

def marume(a):
    b=a
    while a//10!=0:
        a=a%10
    if a!=0:
        b=b-a+10
    return b

A=[int(input())for _ in range(5)]
last_order=9
ans=0
for i in range(5):
    if 0 < last_num(A[i]) < last_order:
        last_order=last_num(A[i])
        order_num=i
for j in range(5):
    if j !=order_num:
        ans+=marume(A[j])
    else:
        ans+=A[j]
print(ans)
