Frank Adler (Chris Evans) has raised his 7-year-old niece Mary (Mckenna Grace) after her mother committed suicide when she was only 6 months old. Mary has an incredible knowledge of math and arithmetic equations, which does not go unnoticed by her educators. However, Frank doesn't want Mary to have a prestigious education, but rather a normal one like her mother would have wanted.
Frank's distant mother Evelyn (Lindsay Duncan) shows up to try and claim custody of her granddaughter so that she can be taught in the best schools and have a bright future. This leads to a custody battle between Frank and Evelyn. Frank's lawyer feels that they will lose the case and that it would be in the best interest of everyone if he accepts a deal where Mary would be placed in foster care until she is 12 and can decide where she wants to stay. Frank makes the hard choice to let Mary go.
After learning that Evelyn is maintaining some level of personal custody, Frank brings her a completed problem that Mary's mother had tried to solve (she was a brilliant mathematician prior to her death) and says that he will have it published if Evelyn gives up custody back to Frank, or else it won't be made public until after Evelyn dies.
Frank gets Mary back and she is allowed a normal childhood/education while also taking college courses.