Hide

# Problem MTricky Factoring

Ms. Alice was working on making some factoring homework for her students last week, where the students get questions in the form of $ax^2+bx+c$, and must rewrite the expression in the form $(dx+ e)(fx + g)$, where $a,b,c,d,e,f,g$ are integers. However, last night the ZomBs invaded her house! The next day, when Ms. Alice woke up, she found that the ZomBs had eaten all the $b$s! They had eaten the middle number on all her factoring questions that she spent all week making for her students. Ms. Alice decided that instead of remaking all her questions, she would just ask her students how many possible values there are for $b$ that would make the expression $ax^2+bx+c$ factorable.

The expression $ax^2+bx+c$ is factorable if and only if the expression $ax^2+bx+c$ is able to be successfully rewritten in the form $(dx+ e)(fx + g)$, where $a,b,c,d,e,f,g$ are integers.

As one of Ms. Alice’s students, you must come up with a solution to her tricky new problem!

## Input

The input consists of two space separated integers $0<a,c\leq 10^{16}$. It is guaranteed that all prime factors of $a$ and $c$ are less than $10^6$.

## Output

The number of possible integer values $b$ that would make $ax^2+bx+c$ factorable.

Sample Input 1 Sample Output 1
1 1

2

Sample Input 2 Sample Output 2
12 33

18

Sample Input 3 Sample Output 3
5040 24

128

Sample Input 4 Sample Output 4
7560 10080

486