a=int(input())
p=a%10
b=int(input())
q=b%10
c=int(input())
r=c%10
d=int(input())
s=d%10
e=int(input())
t=e%10
l=[a,b,c,d,e]
m=[p,q,r,s,t]
ans=0
minimum=min(list(set(m)-set([0])))
def func(n):
    if n%10==0:
        return n
    else:
        return (n//10)*10+10
for i in range(5):
    ans+=func(l[i])
ans=ans-10+minimum
print(ans)