A = sorted( [input()[::-1] for i in range(5)] )
while (A[0][0] == "0"):
  tmp = A.pop(0)
  A.append(tmp)

A = [int(a[::-1]) for a in A][::-1]

def roundUp(n):
  return n if n%10==0 else n + (10-n%10)

print(sum([roundUp(A[i]) for i in range(4)]) + A[4])
