You need to slingshot around the sun to build up speed and then use the other one to slow down. It's all very complicated and involves some complicated maths.
If you don't get it right, you end up having your ship go back in time and the only way to get back again is to reverse the manuever, but with some whales from San Francisco in your hold....