lst = []
for i in range(5):
  n = int(input())
  lst.append([n % 10, n])
lst = sorted(lst)

res = 0
for i in range(5):
  if i == 0:
    res += lst[i][1]
  else:
    res += (lst[i][1] + 9) // 10 * 10
print(res)