M = [int(input()) for i in range(5)]
T = M[:]
tmp = 10
for i in range(5):
  if tmp > M[i] % 10 > 0:
    tmp = M[i] % 10
    c = i
  if M[i] % 10 != 0:
    M[i] += 10 - (M[i] % 10)
M[c] = T[c]
print(sum(M))