import math
n = [int(input()) for i in range(5)]
hld = 9
answer = 0
for i in n:
  last_dig = i % 10
  if last_dig <= hld:
    hld = last_dig
  answer += math.ceil(i/10)*10
if hld != 0:
  print(answer - 10 + hld)
else:
  print(answer + hld)