Problem: There are glasses on the table numbered . The glass can hold up to units of water, and currently contains units of water.
You would like to choose glasses and collect as much water in them as possible. To that effect you can pour water from one glass to another as many times as you like. However, because of the glasses' awkward shape (and totally unrelated to your natural clumsiness), each time you try to transfer any amount of water, half of the amount is spilled on the floor.
Formally, suppose a glass currently contains units of water, and a glass contains units of water. Suppose you try to transfer units from glass to glass (naturally, can not exceed ). Then, units is spilled on the floor. After the transfer is done, the glass will contain units, and the glass will contain units (excess water that doesn't fit in the glass is also spilled).
Each time you transfer water, you can arbitrarlly choose from which glass to which glass to pour, and also the amount transferred can be any positive real number.
For each , determine the largest possible total amount of water that can be collected in arbitrarily chosen glasses after transferring water between glasses zero or more times.
Input Format: The first line contains a single integer () — the number of glasses.
The following lines describe the glasses. The -th of these lines contains two integers and (, ) — capacity, and water amount currently contained for the glass , respectively.
Output Format: Print real numbers — the largest amount of water that can be collected in glasses respectively. Your answer will be accepted if each number is within absolute or relative tolerance of the precise answer.
Note: In the sample case, you can act as follows:
- for , transfer water from the first two glasses to the third one, spilling units and securing units;
- for , transfer water from the third glass to any of the first two, spilling unit and securing units;
- for , do nothing. All units are secured.