Alex and Bob are brothers. Alex is the elder brother, and Bob is the younger one.
Since the last New Year Day, their parents started giving them pocket money as a fee for
household assistance or good marks in school. The children are in the seventh heaven. They became A-students, run to the shop one ahead of another to buy some bread and clean the room in the sake of making more money. Brothers do not spend their money but store them in two separate piggy-banks: Alex wants to buy a bicycle, and Bob aims to save a million.
Alex is the elder brother, so he would become angry if at some moment the sum in the piggy-bank of the younger brother becomes greater than in his one. Certainly, he would break all the windows in the nearest house in such case. Bob is above all this — he has a great aim, so such an issue is not worth breaking nerves.
Poor brothers! They don't know that in fact not all their good deeds will be paid, and the sums to be given away for them are determined well ahead. Notably, during this year Alex will be given K euros, and Bob will be given M euros. A good deed is rewarded by giving 1 euro, and in no case the brothers would be paid simultaneously.
Consider K good deeds of Alex and M those of Bob which will be paid off and assume that every permutation of those deeds is equally probable. Find the probability for the window in the next house to remain unbroken during the year.
In the first line there is the number of test cases N. N ≤ 2004.
Each of the next N lines consists of two integers Ki and Mi — the amounts of money to be paid to elder and younger brother, respectively. 0 ≤ Ki, Mi ≤ 104.
For each test case, output the answer on a separate line with precision not less than 10−6.
Problem Source: SPbSU ITMO contest. Petrozavodsk training camp. Winter 2008.