M = []
for i in range(5):
  M.append(int(input()))

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