We say to eventually become a good you have to use something that initially cost you much but which, in the end, the benefits of this approach will be superior to the sacrifices.
It is the same as saying " in the end it was for your sake "
After critiar the solution is carried out was positive instead of negative