MacGyver hurries to make a court date on Halloween: character witness at the sanity hearing for Dr. Zito. Pete and Murphy are waiting for him, and note that Zito is acting perfectly sane. It's been five years since Zito was tried, and Murphy is worried the judge will dismiss the case. Psychiatrist Dr. Marion Skinner is testifying on Zito's behalf. MacGyver testifies about how he met Zito two years ago when he engineered Eric Cross' escape from the state mental hospital, then manipulated Eric into trying to murder Murphy. He states that Zito is evil and Skinner objects. The judge overrides her, then asks MacGyver if Eric ever admitted Zito was responsible. MacGyver admits that Eric hung himself in his cell before anyone could verify his story. Zito's attorney declines to cross-examine and the judge rules that Zito is more dangerous than ever and will remain incarcerated.
Zito thanks Dr. Skinner for her help and she asks him to sign an appeal. He signs the papers and tries to hide the pen, but his orderly Charles makes sure that he returns it. As he leaves, Zito notes to Murphy and MacGyver that the fates have brought them together. He comments that MacGyver judged him evil, and promises to give MacGyver a lesson in evil some day. As Zito is escorted, he asks to use the drinking fountain and uses the ink cartridge he extracted from the pen to open his handcuffs. He gets on the elevator with Charles and the other orderly. Meanwhile, Skinner overhears Murphy talking about Zito's act and insists that it's no act. They hear screaming from the elevator: a secretary finds the bodies of Zito's orderlies. The doctor climbs down the elevator shaft, steals a bailiff's uniform, and slips out of the courthouse. He leaves the bloody ink cartridge in the basket of two trick-or-treaters. Skinner sees him and runs inside to call for help, but by the time MacGyver and Murphy emerge Zito is long gone.
Captain Kiley checks the bodies and finds a note to MacGyver talking about the lesson in evil beginning. There's a mathematical formula: "(6 x 2 ) - 8 =". MacGyver figures it signifies Cell 4, where Zito was kept. Murphy and MacGyver go to the cell and find a deck of playing cards. Inside is Zito's hospital library card and MacGyver figures that Zito has been preparing the lesson since their last encounter. As they leave, MacGyver gets a call from Zito: the doctor tells him he'll have to deal with the matter by the numbers. Zito tells him to find his "homework assignment" at the payphone outside the hospital. They rush outside and find a set of scales of justice, twine, and a bloody pair of shears. Another formula is drawn on the phone booth glass: "(3 x 10) / 2 =".
At the police station, MacGyver and Murphy go over the clues and figures that the answer, 15, has something to do with the prison library. Skinner helps by bringing in the books and they go through examining anything related to 15. Finally, MacGyver finds another formula on page 15 of a book on Greek mythology: "(10 + 8) / 6 =". The page talks about the Three Fates, and MacGyver remembers that Zito mentioned fate bringing them together. Zito calls and confirms MacGyver is following his "lesson." He tells MacGyver that evil is unpredictable and he'll get a riddle when he least expects it, and it can strike at anyone. MacGyver asks why him and Zito says that the game never ends and he will win this time: it's in the hands of the Fates. They're unable to trace the call in the time allowed. Pete calls from the analysis lab and says they found another formula on the shears: "(2 x 12) - 4 =".
Pete leaves for the police station while Skinner notices that Murphy is overly zealous. She objects to Murphy's involvement and Kiley assures her that Murphy will attempt to capture Zito, not kill him. MacGyver plays the tape back and remembers that Zito is familiar with police procedure. He concludes that Zito figures they'd send the evidence to the Phoenix laboratories, and that the doctor is going after Pete. "20" is Pete's parking space at Phoenix Research. They try to call Pete but he's already outside at his car. As he turns on the headlights, he sees another formula on the wall in front of him: "(5 x 9) / 3 = ". Zito is hiding in the car and holds a gun to Pete's head. He takes Pete to a hospital cell and chains and gags him, explaining the gag was used to keep patients from biting off their tongues.
MacGyver and Murphy go over the new formula and MacGyver looks at a picture of the three Fates. He notices that one holds string, one holds the scales of justice, and one holds shears. Kiley tells them that his men have located Pete's car, parked in front of the police station. In the trunk is an old doormat, which MacGyver recognizes as his own. They go to MacGyver's houseboat and Murphy insists on going in first. They find Pete tied and gagged on the floor. As MacGyver frees him, Murphy starts to move upstairs. There's another formula painted on the wall: "(3 x 5) + 3 =" and "P.S. Goodbye Murphy". MacGyver tries to warn Murphy too late: an explosive charge goes off, throwing her off the stairs to the floor below. Skinner comes to the houseboat as the EMTs move Murphy out. As she's taken out, Murphy tells MacGyver that Zito knew she'd conduct a search and the bomb was for her. Skinner apologizes and Murphy admits she was too emotionally involved. MacGyver tries to get Pete to remember anything he can and he mentions he was in an old musty building with a bathroom. Skinner remembers that Zito said he planned on going to a monastery if he was freed. She offers to bring the transcripts to the station. As she prepares to leave, she discovers her car isn't working. She spots a taxi nearby and hails it. In the houseboat, MacGyver figures out that each formula answer is a letter of the alphabet: they spell out "DOCTOR." They run outside just in time to see drive away with a captive Skinner.
Zito is rigging a section of flooring in a bell tower. Meanwhile, MacGyver is going over the transcript tapes when Zito calls to tell him he has one hour to find his "sanctuary" and he has to come alone. Zito has chained Skinner inside of a tub and hangs an electric heater inside of it. He turns on the water and the level slowly rises. At the police station, MacGyver realizes that Zito is talking about an old asylum that was originally a monastery. MacGyver insists on going in alone per Zito's instructions but Kiley assures him they'll be waiting nearby.
At the abandoned asylum, Zito locks Skinner's cell door and thanks her for her help. He puts the key around his neck and leaves. MacGyver slips in through a window and finds Skinner, but is unable to get the cell door open. Zito taunts him from behind another door down the hall, and tells him to come and get the key. MacGyver goes after him up into the bell tower. Zito is waiting for him at the top with a gun, and says MacGyver will have to kill him to "pass" the "exam." He puts the gun down on the floor and dares MacGyver to kill him. When MacGyver refuses, Zito reminds him of Murphy and how he'll visit her later to finish the job. MacGyver starts to pick up the gun, then notices a rope below, leading to the monastery bell. MacGyver tells Zito he's solved the riddle: the rope is the thread of the Fates, the gun the shears to cut it off. That leaves the scales: the gun is on a balanced piece of flooring. MacGyver applies the slightest bit of weight, and the bell knocks him over. Zito attacks him and MacGyver falls off the ledge and hangs on. Zito informs MacGyver that he's lost and steps on his hand. MacGyver loses his grip and leaps to the rope, causing the bell to swing into Zito and knock him out. He climbs to safety and ties Zito up with the bell rope. He takes the key and then punches Zito, knocking him over the ledge where he dangles below the bell. MacGyver runs downstairs and saves Skinner just in time.
Later, MacGyver brings a recovering Murphy to the police station where her co-workers, Pete, and Skinner are waiting to greet her. Zito is back in maximum security and Skinner assures them he'll never escape. In his cell, Zito removes another hidden ink cartridge from a fake scar on his abdomen.