import math
m = [int(input()) for i in range(5)]

last = min((m[i] - 1) % 10 + 1 for i in range(5))
last1 = int(str(last)[-1])
sum = sum(math.ceil(m[i] / 10) * 10 for i in range(5))

print(sum+last1-10)