Problem E. The Turanga Leela Problem

Leela
Turanga Leela, from Futurama

It’s been a few years since Bender solved his famous bending problem. Today, Turanga Leela, son of Morris and Munda and captain of the Planet Express spaceship, is playing a game with Bender and Philip J. Fry.

Everybody knows that Leela is cyclop. When Leela was still an infant, her parents gave her up to an orphanarium with a note scribbled with mysterious symbols to make an impression that Leela was an alien, so that she would have a better life than a typical mutant. But other kids used to make fun of her only eye, so Leela had a very perturbing childhood.

Bender and Philip J. Fry are making fun of Leela, because apparently she doesn’t know how to count (they say her parents didn’t know how to count either, and that’s why she has only one eye. Then they burst out in explosive laughter). She insists that she knows how to count, but secretly she needs your help.

Philip J. Fry chooses a positive integer a, and Bender chooses a positive integer b. Leela is supposed to count the number of positive integers m such that a and b leave the same remainder when divided by m. In other words, she’s supposed to find the size of the set {m >0 | a b (mod m)}.

But she’s totally clueless on how to proceed. Help her, please!

Input

The input file contains several test cases (at most 150). Each test case is described with two different integers a and b on a single line (1 a, b 109).

The last line contains two zeros and should not be processed.

Output

For each test case, output one integer on a single line  — the number of positive integers m such that a and b leave the same remainer when divided by m.

Sample input and output

standard input
standard output
2 3

2 4

5 7

4 8

100 205

33043387 255936619

0 0

1

2

2

3

8

40

Explanation of the sample cases