menu = [int(input()) for _ in range(5)]
last = 10**18
last_menu = 0
for i in range(5):
  if menu[i]%10 != 0:
    last = min(last, menu[i]%10)
  if last == menu[i]%10:
    num = i
last_menu = menu.pop(num)

time = 0
for j in range(len(menu)):
  if menu[j]%10 == 0:
    time += menu[j]
  else:
    time += menu[j] + (10 - menu[j]%10)
time += last_menu

print(time)