import math
t = []
for i in range(5):
  t.append(int(input()))
ct = [math.ceil(x/10)*10 for x in t]
fraction = [x%10 for x in t]
min_fraction = min(list(filter(lambda x: x > 0, fraction)))
print(sum(ct) - 10 + min_fraction)
