a = []
for _ in range(5):
    b = int(input())
    t = 10 if b%10 == 0 else b%10
    a.append((t, b))
a.sort()
a.reverse()
c = 0
for i in range(4):
    c += (a[i][1] + (10 - a[i][1] % 10))
c += a[-1][1]
print(c)