foods = [int(input()) for i in range(5)]
time = 0
rest = list(map(lambda x: x % 10, foods))
for i in range(5):
    if rest[i] == 0:
        time += foods[i]
    else:
        time += foods[i] - rest[i] + 10

if not all(rest):
   print(time)
else:
    print(time - 10 + min([i for i in rest if i != 0]))