Help Chirag

0

0 votes
Medium-Hard
Problem

Chirag is a Gamer and loves to play Dota 2. At the same time, He is also very studious and loves Math. He wants to use his Math skills to get Better at playing Dota.

In Dota 2, there are two category of Heroes Radiant and Dire.

There are N Radiant Heroes and M Dire Heroes. The game ranks all the Heroes Randomly.
Each Hero gets a rank i such that i>= 1 and i<=N+M.

Rank 1 is considered The Highest rank a Hero can achieve.

To be able to chose Heroes wisely, Chirag needs the Sum of Expected value of the Highest Rank achieved by a Radiant Hero and the Expected value of the Highest Rank achieved by a Dire Heroes.

However Chirag has just started learning Probability, He needs your help.

Input

First line contains a number T.

For next T lines Each Line contains two spaced numbers N M

Output

For each Test case

Output the Expected value P/Q In the Form of P Q (Where P and Q are co-prime)

Constraints

1<=T<=10^5

1<=N<=10^5

1<=M<=10^5

Sample Input
2
1 2
3 3
Sample Output
10 3
7 2
Time Limit: 2
Memory Limit: 256
Source Limit:
Explanation

For test case 1,

Number of Radiant heroes is 1 and Number of Dire heroes are 2

E - Expected probability of Highest rank being x

P(x=i) - probability of Highest rank being x

For Radiant heroes, P(1) = P(2) = P(3)=1/3

E(Radiant) = 2

For Dire Heroes, P(1) = 2/3 P(2) = 1/3

E(Dire) = 2/3+2*1/3= 4/3

Answer = 4/3+2 = 10/3 P=10, Q=3

Editor Image

?