Refactor math example to calculate answer.