li = []
for i in range(5):
    li.append(int(input()))

li2 = [];ans = 0
for i in li:
    if i%10 == 0:
        ans += i
    else:
        ans += i + (10-i%10)
        li2.append(i%10)
if li2 != []:
    ans -= min(li2)

print(ans)

