a=int(input())
b=int(input())
c=int(input())
d=int(input())
e=int(input())
x=[a,b,c,d,e]
jikoku=0
def saisyou(x):
    s=9
    t=9
    p=0
    q=0
    for i in range(5):
        if x[i]<99:
            if 0<x[i]%10<s:
                s=x[i]%10
                p=x[i]
        else:
            if 0<(x[i]-100)%10<t:
                t=(x[i]-100)%10
                q=x[i]
    if s<=t:
        x.remove(p)
        return p
    else:
        x.remove(q)
        return q
jikoku+=saisyou(x)
for i in range(len(x)):
    if x[i]%10==0:
        jikoku+=x[i]
    else:
        jikoku+=(x[i]//10+1)*10
print(jikoku)
