Solve for a q+a/r=n^2