Your task is to find how many complex numbers satisfy the following two conditions: x^n = a + bi and x^m = c + di.
The first line contains integers , , (-10^{18} \le a, b \le 10^{18}, 1 \le n \le 100). The second line contains integers , and (-10^{18} \le c, d \le 10^{18}, 1 \le m \le 100). It is guaranteed that a^2 + b^2 > 0 and c^2 + d^2 > 0.
Print one integer: the answer to the problem.
Example 1
Example 2