import copy
li=[int(input()) for i in range(5)]

ans=10**9
temp=0

for j in li:
    temp = j
    li2 = copy.copy(li)
    li2.remove(j)
    for k in li2:
        temp += k + (10 - (k % 10))
    ans = min(ans, temp)

print(ans)