menu = [ int(input()) for i in range(5)]
menu_per = [j % 10 for j in menu]
ans = 0
for _ in range(len(menu)):
  index = menu_per.index(max(menu_per))
  if ans % 10 == 0:
    ans += menu[index]
  else:
    tmp = int(ans % 10)
    ans += (10 - tmp)
    ans += menu[index]
  menu_per.pop(index)
  menu.pop(index)
print(ans)
    