The Lost Fraction

No attempts yetTime limit1sMemory limit128 MB

Problem

Byteasar came up with a really neat fraction whose denominator is at most nn, but after a while he forgot which fraction it was. He is almost certain that it lay inside the closed interval [an2,a+1n2]\left[\frac{a}{n^2}, \frac{a+1}{n^2}\right]. Help him by finding every fraction inside this interval whose denominator is at most nn.

Here a fraction "with denominator at most nn" means a rational number whose denominator, once the fraction is reduced to lowest terms, is at most nn. Both endpoints of the interval are included.

Input

The only line contains two integers nn and aa separated by a single space (1n<2321 \le n < 2^{32}, 1a<26411 \le a < 2^{64}-1).

Output

On the first line print mm, the number of distinct reduced fractions that lie in the interval [an2,a+1n2]\left[\frac{a}{n^2}, \frac{a+1}{n^2}\right] and have denominator at most nn.

On each of the following mm lines print the numerator and the denominator of one such fraction, separated by a single space. Every fraction must be written in lowest terms, and the fractions must be listed in strictly increasing order of their value.