MI6 agent James Bond meets a Swiss banker in Bilbao, Spain to retrieve money for Sir Robert King, a British oil tycoon and friend of M. Bond tells the banker that King was buying a report stolen from an MI6 agent who was killed for it, and wants to know who killed him. The banker is killed by his assistant before he can reveal the assassin's name. Bond escapes with the money, but it is revealed to be booby-trapped, and Sir Robert is killed by an explosion inside MI6 headquarters back in London. Bond gives chase to the assistant/assassin on a boat on the Thames to the Millennium Dome, where she attempts to escape via hot air balloon. Bond offers her protection, but she refuses, then causes the balloon to explode, killing herself.
Bond traces the recovered money to Renard, a KGB agent-turned-terrorist. Following an earlier attempt on his life by MI6, Renard was left with a bullet in his brain which is gradually destroying his senses, making him immune to pain. M assigns Bond to protect King's daughter, Elektra; Renard previously abducted and held her for ransom, and MI6 believes that he is targeting her a second time. Bond flies to Azerbaijan, where Elektra is overseeing the construction of an oil pipeline. During a tour of the pipeline's proposed route in the mountains, Bond and Elektra are attacked by a hit squad in armed, paraglider-equipped snowmobiles.
Afterwards Bond visits Valentin Zukovsky at a casino to acquire information about Elektra's attackers; he discovers that Elektra's head of security, Davidov, is secretly in league with Renard. Bond kills Davidov and boards a plane bound for a Russian ICBM base in Kazakhstan. He poses as a Russian nuclear scientist, meets American nuclear physicist Christmas Jones, and enters the silo. Inside, Renard is removing the GPS locator card and weapons-grade plutonium from a nuclear bomb. Before Bond can kill him, Jones blows his cover. Renard drops a hint that he and Elektra are collaborating and flees with the plutonium, while Bond and Jones escape the exploding silo with the locator card.
Back in Azerbaijan, Bond discloses to M that Elektra may not be as innocent as she seems. An alarm sounds while he is handing M the locator card as proof of the theft, which reveals that the stolen bomb from Kazakhstan is attached to an inspection rig heading towards the oil terminal. Bond and Jones enter the pipeline to deactivate the bomb, and Jones discovers that half of the plutonium is missing. They both jump clear of the rig, a large section of pipeline is destroyed, and they are presumed killed. Back at the command centre, Elektra reveals she and Renard are conspirators and that she killed her father as revenge for using her as bait for Renard. She abducts M, whom she resents for advising her father not to pay the ransom money, and imprisons her in the Maiden's Tower.
Bond accosts Zukovsky at his caviar factory in the Caspian Sea, which is then attacked by Elektra's sawing helicopters. Later, Zukovsky reveals his arrangement with Elektra was in exchange for the use of a submarine, currently being captained by Zukovsky's nephew, Nikolai. The group goes to Istanbul, where Jones realises that if Renard were to insert the stolen plutonium into the submarine's nuclear reactor, the resulting nuclear explosion would destroy Istanbul, sabotaging the Russians' oil pipeline in the Bosphorus while dramatically increasing the value of Elektra's oil. Bond then gets a signal from the hacked locator card in the Maiden's Tower just before Zukovsky's underling, Bullion blows up the command centre. Zukovsky is knocked unconscious and Bond and Jones are captured by Elektra's henchmen. Jones is taken aboard the submarine, which was seized by Renard's men. Bond is taken to the tower, where Elektra tortures him with a garrote. Zukovsky and his men seize the tower, but Zukovsky is shot by Elektra, freeing Bond with his cane gun with his last act. Bond frees M and kills Elektra.
Bond dives after the submarine, boards it, and frees Jones. Following a fight, the submarine hits the bottom of the Bosphorus, causing its hull to rupture. Bond catches up with Renard and kills him after a lengthy fight in the submarine's reactor. Bond and Jones escape from the submarine, leaving the flooded reactor to detonate safely underwater.
Output: Where does the submarine detonate?