list = [int(input()) for i in range(5)]
min = 9
ans = 0
for i in range(5):
  amari = list[i] % 10
  if amari != 0:
    if amari < min:
      min = amari
      num_min = i
for i in range(5):
  if i != num_min:
    ans += int(round(list[i], -1))
  else:
    ans += list[i]
print(ans)