Complex Root
Easy
Execution time limit is 1 second
Runtime memory usage limit is 128 megabytes
Your task is to find how many complex numbers x satisfy the following two conditions: x^n
= a + bi and x^m
= c + di.
Input
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.
Output
Print one integer: the answer to the problem.
Examples
Input #1
Answer #1
Input #2
Answer #2
Submissions 23
Acceptance rate 17%