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