Fry accidentally tied his only pants to a weather balloon Professor Farnsworth released to gather data on a bizarre series of weather patterns on Earth. He then shoots the weather balloon down to retrieve it, whereby it landed on Central Park only for it to be taken away by a Central Park badger. As the Planet Express crew follows the badger, with Leela breaking her leg when Fry tries to save her from falling, the crew discovers an ancient Martian pyramid and calendar predicting that the world is going to end in 3012. Based on the data gathered from the weather balloon, Professor Farnsworth finds out that the Sun is going to release a solar flare that will destroy Earth.
An electromagnetical storm then strikes Earth, rendering all electrical appliances, including spaceships useless. But Amy finds out that the pyramid they discovered is actually a spaceship that can hold 30,000 people and runs on snakes. The crew tried to test the spaceship for themselves, but was caught by Zapp and brought before President Nixon. The President then decides that a Decision Making Machine is to be used to select the most optimal cross-sections of humanity to be taken to Mars where they will start life anew. Fry was selected for his 'lucky pants' while Leela is rejected due to Zapp being the pilot of the spaceship. Before boarding begin, Fry disguises his ticket as one for Leela and decides to remain on Earth with Bender, who stays to loot.
After arriving at Mars, whereby they are greeted by Amy's parents, Leo and Inez, the humans are approached by Singing Wind, who clarifies that the Deathwing will actually strike Mars, not Earth as speculated as the Deathwing will bypass Earth and reach Mars. Amy is then blamed over the predicament, saying that she got mixed up between the Ancient and Modern Martian language in trying to decipher the ancient Martian calendar.
The humans tried to escape, but couldn't because Zapp has dismantled the stone spaceship to build a memorial for those who stayed behind Earth. As the Deathwing strikes Mars, it ignites the gases contained in its crust and causes it to propel towards Earth. The humans managed to jump off Mars back onto Earth as it goes nearby their home planet. However, Leela was unable to jump back due to her broken leg. Fry then stood on top of the Planet Express building hoping to catch Leela as Mars closes by but only manages to tear off each other's arms in the process. Later, it is revealed that Scruffy rescued Leela with a ladder. With Mars still on Earth's orbit, Professor Farnsworth uses the birth machine first seen on 'Rebirth' to make new arms for Fry and Leela while their torn off arms are then shown floating off in space, held to each other.