decided the value of p and q