import math


nums = list(map(int, [input() for _ in range(5)]))
s = sum(math.ceil(num / 10) * 10 for num in nums)
m = min(int(str(num)[-1]) for num in nums if num % 10 != 0)
if m != 0:
  s -= (10-m)
print(s)