#2019/10/04
time = list(map(int, open(0).read().split()))
# print(time)

time_residual = [i%10 for i in time]
# print(time_residual)

time_residual_notZero = [i for i in time_residual if i%10 != 0 ]
# print(time_residual_notZero)

min_index = time_residual.index(min(time_residual_notZero))
# print(min_index)

ans = sum([-(-i//10)*10 for i in time]) + time_residual[min_index] - 10
print(ans)