array = [int(input()) for i in range(5)]
array_sub = [i % 10 for i in array]
new_lst = [i for i in array_sub if i != 0]
minimum = min(new_lst)
sum = 0
for i in array:
  if (i % 10 == 0):
    sum += i
  else:
    if (i % 10 == minimum):
      sum += i
    else:
      sum += (i + (10 - (i % 10)))
print(sum)