list = [int(input()) for n in range(5)]
min = 100
for i in range(5):
  if min > list[i] % 10:
    min = list[i] % 10
    min_arg = i
ans = 0
for i in range(5):
  if i == min_arg:
    continue
  ans += list[i]
  if ans % 10 != 0:
    ans = ans - (ans % 10) + 10
  
ans += list[min_arg]
print(ans)