"Madeleine" at Golden Gate Bridge, Fort Point, shortly before she jumps into the bay.After a rooftop chase, where his fear of heights and vertigo result in the death of a policeman, San Francisco detective John "Scottie" Ferguson retires. Scottie tries to conquer his fear, but his friend and ex-fiancÃ©e Midge Wood says that another severe emotional shock may be the only cure.An acquaintance from college, Gavin Elster, asks Scottie to follow his wife, Madeleine, claiming she has been possessed. Scottie reluctantly agrees, and follows Madeleine to a florist where she buys a bouquet of flowers, to the Mission San Francisco de AsÃ­s and the grave of Carlotta Valdes, and to an art museum where she gazes at the Portrait of Carlotta. He watches her enter the McKittrick Hotel, but on investigation she does not seem to be there.A local historian explains that Carlotta Valdes tragically committed suicide. Gavin reveals that Carlotta (who he fears is possessing Madeleine) is Madeleine's great-grandmother, although Madeleine has no knowledge of this, and does not remember the places she has visited. Scottie tails Madeleine to Fort Point and, when she leaps into the bay, he rescues her.The next day Scottie follows Madeleine; they meet and spend the day together. They travel to Muir Woods and Cypress Point on 17-Mile Drive, where Madeleine runs down towards the ocean. Scottie grabs her and they embrace. Madeleine recounts a nightmare and Scottie identifies its setting as Mission San Juan Bautista. He drives her there and they express their love for each other. Madeleine suddenly runs into the church and up the bell tower. Scottie, halted on the steps by his vertigo, sees Madeleine plunge to her death.The death is declared a suicide. Gavin does not fault Scottie, but Scottie breaks down, becomes clinically depressed and is in a sanatorium, almost catatonic. After release, Scottie frequents the places that Madeleine visited, often imagining that he sees her. One day, he notices a woman who reminds him of Madeleine, despite her different appearance. Scottie follows her and she identifies herself as Judy Barton, from Salina, Kansas.A flashback reveals that Judy was the person Scottie knew as "Madeleine Elster"; she was impersonating Gavin's wife as part of a murder plot. Judy drafts a letter to Scottie explaining her involvement: Gavin had deliberately taken advantage of Scottie's acrophobia to substitute his wife's freshly killed body in the apparent "suicide jump". But Judy rips up the letter and continues the charade, because she loves Scottie.They begin seeing each other, but Scottie remains obsessed with "Madeleine", and asks Judy to change her clothes and hair so that she resembles Madeleine. After Judy complies, hoping that they may finally find happiness together, he notices her wearing the necklace portrayed in the painting of Carlotta, and realizes the truth. He insists on driving her to the Mission.There, he tells her he must re-enact the event that led to his madness, admitting he now understands that "Madeleine" and Judy are the same person. Scottie forces her up the bell tower and makes her admit her deceit. Scottie reaches the top, finally conquering his acrophobia. Judy confesses that Gavin paid her to impersonate a "possessed" Madeleine; Gavin faked the suicide by throwing the body of his wife from the bell tower.Judy begs Scottie to forgive her, because she loves him. He embraces her, but a shadowed figure rises from the trapdoor of the tower, startling Judy, who steps backward and falls to her death. Scottie, bereft again, stands on the ledge, while the figure, a nun investigating the noise, rings the mission bell.
Output: Question: wher Scottie is clinically depressed ?, Answer: sanatorium