A = []
ans = 0
for _ in range(5):
  a = int(input())
  if a % 10 == 0: ans += a
  else: A.append(a)
A.sort(key = lambda x:x%10)
for i in range(1, len(A)+1):
  if A[-i] != A[0]:ans += 10 - (A[-i]%10) + A[-i]
  else: ans += A[-i]
print(ans)