X = [str(input()) for _ in range(5)]
endzero = 0
elesnum = []
for x in X:
  if x[-1] == "0":
    endzero += int(x)
  else:
    elesnum.append(x)
elesnum.sort(key = lambda x: x[-1])
min_ = int(elesnum[0])
for e in elesnum[1:]:
  endzero += (int(e)//10+1)*10
print(endzero+min_)