times = [int(input()) for i in range(5)]
summ = sum(times)

time = times[:]

for i in range(5):
  while time[i] - 10 >= 0:
    time[i] -= 10

unko = [10-i for i in time]

while 10 in unko:
  unko.remove(10)

unko.remove(max(unko))

print(summ+sum(unko))