A = [0] * 5

A[0] = int(input())
A[1] = int(input())
A[2] = int(input())
A[3] = int(input())
A[4] = int(input())

maximum = 0
for i in range(5):
  tmp = (A[i] // 10 + 1) * 10 - A[i]
  A[i] = (A[i] // 10 + 1) * 10
  if tmp > maximum:
    maximum = tmp
    
print(sum(A) - maximum)