fix p and q values