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