li = [int(input()) for _ in range(5)]
li_mod = [[i % 10, i] for i in li if i % 10 != 0]
li_mod_r = [i for i in li if i % 10 == 0]
li_mod = sorted(li_mod, reverse = True)
time = 0
for lis in li_mod[:-1]:
  time += lis[1] + (10-lis[0])
time += sum(li_mod_r)
time += li_mod[-1][1]
print(time)