#P7842. Jogging

Jogging

Jogging

Problem Description

Notice:Don't output extra spaces at the end of one line. Dodo bird is jogging on an infinite 2-d plane, starting from (x0,y0)(x_0, y_0). For a point(x,y)(x, y), it is regarded as good if and only if gcd(x,y)>1\gcd(x,y)>1. Dodo bird will walk infinite steps on the plane under the following strategy: Assume he is currently at (x,y)(x, y), let SS be the set of good points among $(x-1,y-1),(x-1,y),(x-1,y+1),(x,y-1),(x,y+1),(x+1,y-1),(x+1,y),(x+1,y+1)$, zz be the size of SS. He has a probability of 1z+1\frac{1}{z+1} to stay in (x,y)(x, y), and he also has a probility of zz+1\frac{z}{z+1} to move to a point in SS. If he chooses to move, the probility of going to any point in SS is equal. Define ptp_t as the probability of coming back to (x0,y0)(x_0, y_0) after walking tt steps, please calculate limtpt\lim_{t \to \infty}p_t. It is guaranteed that the answer always exists.

Input

The first line contains an integer T(1T1000)T(1 \leq T \leq 1000), indicating the number of test cases. Each test case has one line, which contains two integers x,y(2x0,y01012)x, y(2 \leq x_0, y_0 \leq 10^{12}), indicating the position of the start point. It is guaranteed that gcd(x0,y0)>1\gcd(x_0,y_0) > 1.

Output

TT lines, each line contains an irreducible fraction, indicating the answer.

Sample Input

3
18 16
18 6
18 8

Sample Output

0/1
1/1
2/7

Source

2020 Multi-University Training Contest 7