array1 = [int(input()) for i in range(5)]
array2 = [i % 10 for i in array1]
array3 = [i for i in array2 if i != 0]
idx = array3.index(min(array3))
sum1 = 0
sum2 = sum(array2)
for k, i in enumerate(array3):
  if (k == idx):
    sum1 += i
  else:
    sum1 += i + (10 - i % 10)
print(sum1 + sum2)