Time

18:16:01
22 May 2012
Version for print

GCD and LCM

   Given two positive integers A and B. Find the number of pairs of numbers (P, Q), which for them is A GCD(P, Q), and B - LCM(P, Q).


Specifications

   Input

   In a single line two positive integers A and B (A < 105B106).

   Output

   Single number - the required number of pairs.


Problem information

Time Limit: 1 seconds
Memory Limit: 64 MB
Balls for the passed test: 10
Complexity: 22% 73/94
Classes: Number theory, GCD, LCM

Example

Example input

3 60

Example output

4


← Least Common Multiple Problems Island of Misfortune →