minutes = []
amaritati = []
for i in range(5):
  minutes.append(int(input()))

for i in minutes:
  amari = i % 10
  if amari != 0:
    amaritati.append(10 - amari)

answer = sum(minutes) + sum(amaritati) - max(amari) * 2
print(answer)