import math

a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())



ans = 0
for i in [a, b, c, d, e]:
    ans += int(math.ceil(i/10)*10)

li = [int(str(a)[-1]), int(str(b)[-1]), int(str(c)[-1]), int(str(d)[-1]), int(str(e)[-1])]
for j in li:
    if j==0:
        li.remove(0)

ans = ans + min(li) - 10
    
print(ans)