a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
ans = 0
l = []
for i in a,b,c,d,e:
    k = 10-i%10
    if k != 10:
        l.append(k)
l.pop(l.index(max(l)))
ans = a + b + c + d + e + sum(l)
print(ans)