Marble Madness

No attempts yetTime limit1sMemory limit256 MB

Problem

Oyvind tests job applicants with games. This one starts with a bag holding BB black marbles and WW white marbles. Outside the bag you have an unlimited supply of marbles of both colors.

The game runs in rounds. In each round you take two marbles out of the bag at random and put one marble back in. The color you put back depends on what came out.

  1. Two white marbles came out: put a black marble in.
  2. One black marble and one white marble came out: put a white marble in.
  3. Two black marbles came out: put a black marble in.

Each round leaves the bag with one marble fewer, so the game ends when a single marble remains. Given the starting counts, find the probability that this last marble is black and the probability that it is white.

Input

The first line has the number of test cases TT. Each of the next TT lines has two integers BB and WW separated by one space, the number of black marbles and the number of white marbles in the bag at the start.

  • 0<T1000 < T \le 100
  • 0B,W500000 \le B, W \le 50000
  • 0<B+W0 < B + W

Output

Print one line for each test case with two numbers separated by one space. The first number is the probability that the last marble is black, the second is the probability that it is white. Print both probabilities with exactly two digits after the decimal point.