Solution to the P and S math problem.