l = [int(input()) for i in range(5)]
rest = []
time = 0
for v in l:
  if v %10 == 0:
    time += v
  else:
    time += int(v/10)*10
    rest.append(v%10)
if rest != []:
  time += (len(rest)-1)
  time += min(rest)
print(time)