li = []
l = []
for i in range(5):
    a = int(input())
    li.append(a)
    l.append(a%10)
ind = l.index(min(l))
ans = 0
for i in range(5):
    if i != ind:
        ans += (li[i] + 10- l[i]) 
print(ans+li[ind])              