import math
cooks = [int(input()) for _ in range(5)]
sorted_cooks = sorted(cooks, key=lambda x: -int(str(x)[-1]))
ans = 0
for i in range(len(sorted_cooks)):
  if(i < len(sorted_cooks) - 1):
    ans += math.ceil(sorted_cooks[i] / 10) * 10
  else:
    ans += sorted_cooks[i]
print(ans)