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 of input contains integers a, b, and 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 and c^{2} + d^{2} > 0.
Output
Output one integer: the answer to the problem.
Samples
input  output 

0 1 2
1 0 2
 0

1 0 2
1 0 4
 2

Problem Author: Mikhail Rubinchik (prepared by Olga Soboleva)
Problem Source: Ural FU contest. Kontur Cup. Petrozavodsk training camp. Winter 2013