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

l = [a, b, c, d, e]
s = []
for i in l:
    if i % 10 > 0:
        s.append(10 - (i % 10))    
s.sort()
del s[-1]
ans = sum(l) + sum(s)
print(ans)