A computer program named Eunoia is successful if it is able to place two checkers in a $$N$$ x $$M$$ grid-board(a rectangular board that has $$N$$ x $$M$$ cells) such that both the below conditions are satisfied :
- the row number of the checkers are not equal.
- the column number of the checkers are not equal.
Else, the program has failed.
Find the success probability of Eunoia if it randomly places the checkers on the board.
Note: Both the checkers cannot be placed in the same cell.
Input Format: -
First line contains $$T$$ – no of testcases. Next $$T$$ lines has two spaced integers $$N$$ and $$M$$.
Output Format: -
Print $$T$$ lines, the ith line corresponds to the answer of ith test case where two spaced integers $$P$$ and $$Q$$ are output denoting the success probability, $$P$$/$$Q$$ where P and Q are co-prime.
if the probability is 0, output "0 1" in-place of P and Q.
Constraints:
1 <= $$T$$ <= 100
1 <= $$N$$ , $$M$$<= 109
$$N$$ + $$M$$ >= 3
Please login to use the editor
You need to be logged in to access the code editor
Loading...
Please wait while we load the editor
No editorial available for this problem.