In 1815, French prisoner Jean Valjean is released on parole from Toulon prison after serving nineteen years for stealing a loaf of bread and trying to escape multiple times. On the outside, Valjean s paroled status prevents him from getting work. He is offered shelter by the kindly Bishop of Digne, but Valjean steals his silverware. Captured by police and taken to the Bishop, Valjean is shocked when the Bishop says he gave him the silver, telling him to use it to do something worthwhile with his life. Valjean breaks his parole to start a new life.
Eight years later, Valjean is factory owner and mayor of Montreuil, Pas-de-Calais. He is shocked when a Toulon prison guard Javert arrives as his new chief of police. Javert suspects Valjean s identity when he rescues an injured worker trapped under a heavy cart. One of Valjean s workers, Fantine, is dismissed by the factory foreman upon learning she is sending her earnings to her illegitimate daughter Cosette, who lives with the greedy innkeepers, the Th nardiers. To support her daughter, Fantine becomes a prostitute but is arrested by Javert when she attacks an abusive customer. Valjean, learning who she is, has her hospitalised.
Valjean learns a man has been wrongly identified as him, and reveals his true identity to a court before returning to the dying Fantine, promising to care for Cosette. Javert arrives but Valjean escapes, finding Cosette and pays Fantine s debts to the Th nardiers. Valjean and Cosette flee Javert, hiding in a convent, aided by the worker Valjean rescued before. Nine years later, Valjean has become a philanthropist and helps the poor in Paris. General Lamarque, the only government official sympathetic to the poor, dies, and a group of revolutionists called the Friends of the ABC plot to rebel against the monarchy. Marius Pontmercy, a member of the Friends, encounters Cosette and they fall in love, asking  ponine, the Th nardiers  daughter to help find her.
After Marius and Cosette meet and confess their love,  ponine prevents her father from robbing Valjean s house. Valjean, believing Javert is near, makes plans to flee to England with Cosette. Cosette writes a letter for Marius, but  ponine hides it, intending on dying with Marius during the rebellion. During Lamarque s funeral procession, the revolt begins and barricades are built across Paris. Javert pretends to be an ally to spy on the rebels but the street urchin Gavroche exposes him as a policeman. During the first skirmish against the soldiers,  ponine takes a bullet for Marius and dies in his arms, giving him Cosette s letter and confesses to him beforehand. Gavroche takes Marius  reply to Valjean, who joins the revolution to guard Marius.
Valjean offers to execute Javert but actually releases him, faking his death. By dawn, the soldiers are close to ending the revolution, storming the students  barricade and killing everyone save Marius and Valjean, who escape into the sewers. Th nardier comes across Valjean and the unconscious Marius, stealing the latter s ring, before pointing a way out. Valjean finds Javert waiting for him, ignoring his nemesis  threats. Javert, morally confused by the mercy of Valjean, commits suicide by throwing himself in the Seine. Marius recovers but is traumatised by the death of his friends.
Marius and Cosette plan to marry but Valjean, concerned his presence would threaten their happiness, makes plans to leave and reveals his identity to Marius, who promises to remain silent. Cosette and Marius marry but the Th nardiers crash the wedding to try and blackmail Marius, Th nardier saying he witnessed Valjean carrying a murdered corpse and produces the stolen ring. Marius assaults Th nardier who reveals Valjean is at the convent. The dying Valjean reunites with Cosette and Marius, giving them letters of confession, before peacefully dying, guided away by Fantine and the Bishop s spirits.
Output: How many years did Jean Valjean serve in prison?