CO-CO met Prophet and invited him to join his team. But Prophet didn’t want his boss be just a sailor. So Prophet proposed a relatively popular question – “quadratic equation”. Prophet said he would stay if CO-CO can solve the problem. Fortunately CO-CO solved it quickly. But Prophet seemed very unhappy with his pride, so he added a condition:
X is the minimum non-negative integer which satisfied the above equation.
Can you help poor CO-CO to solve the problem under the new condition?
The input includes several cases. For each case, there is only one line contain A,B,C and p. (-200000000<A, B, C, p<200000000,and p is a prime)
For each case, output a single integer x. If the equation has no solution, just output -1.