
t = [int(input()) for i in range(5)]
min=9
length=len(t)
for i in range(length):
    if min%10>t[i]%10 and t[i]%10!=0:
        min=t[i]
t.remove(min)
t.append(min)
ans=0
for _ in range(length-1):
    if t[_]%10!=0:
        ans+=t[_]+10-t[_]%10
    else:
        ans+=t[_]
print(ans+t[length-1])


