National Olympiad in Informatics, China, 2001
Given an -th order equation:
where: are the unknowns, are the coefficients, and are the exponents. Additionally, each value in the equation is an integer.
Assume that the unknowns will satisfy for . Find the number of integer solutions.
Input Specification
The first line of input contains the integer .
The second line of input contains the integer .
Lines 3 to will each contain two space-separated integers, the
values of and respectively. Line 3 corresponds to when
, and line corresponds to when .
Output Specification
Output one integer - the number of integer solutions that solve the equation.
Sample Input
3
150
1 2
-1 2
1 2
Sample Output
178
Constraints
- The number of solutions will be less than .
- The exponents in this problem will each be a positive integer.
Problem translated to English by .
Comments