Investing can mean short-term pain for long-term gain