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