Mass of the spaceship, ms = 1000 kg
Mass of the Sun, M = 2 × 1030 kg
Mass of Mars, mm = 6.4 × 1023 kg
Orbital radius of Mars, R = 2.28 × 108 kg =2.28 × 1011m
Radius of Mars, r = 3395 km = 3.395 × 106 m
Universal gravitational constant, G = 6.67 × 10–11 m2kg–2
Potential energy of the spaceship due to the gravitational attraction of the Sun 
Potential energy of the spaceship due to the gravitational attraction of Mars 
Since the spaceship is stationed on Mars, its velocity and hence, its kinetic energy will be zero.

The negative sign indicates that the system is in bound state.
Energy required for launching the spaceship out of the solar system
= – (Total energy of the spaceship)
