Scheherazade asks Shahriyar to spare her three sons, whom she bore during the thousand nights, and if he will spare her, their mother. He agrees to spare her and forget the past, and officially celebrate his marriage to her. Shah Zaman, who also repents, marries Dunyazad. Scheherazade's father becomes a Viceroy, and King Shahriyar has all of his wife's stories written down in The marvels and wonders of the Thousand Nights and A Night.