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

m = min([i for i in [a % 10, b % 10, c % 10, d % 10, e % 10] if i is not 0])

print((a // 10 + (1 if a % 10 != 0 else 0)) * 10 + (b // 10 + (1 if b % 10 != 0 else 0)) * 10 + (c // 10 + (1 if c % 10 != 0 else 0)) * 10 + (d // 10 + (1 if d % 10 != 0 else 0)) * 10 + (e // 10 + (1 if e % 10 != 0 else 0)) * 10 - 10 + m)
