#Lutece0280. Grove
Grove
Migrated from Lutece 280 Grove
All parts of this problem, including description, images, samples, data and checker, might be broken. If you find bugs in this problem, please contact the admins.
Description
There are many trees in the grove.We can assume that grove is a grid, the grid starts from . Farmer Sherlock is standing at point. He wonders how many trees he can see.
If two trees and Sherlock are in one line, Farmer Sherlock can only see the tree nearest to him.
Input
The first line contains one integer , represents the number of test cases. Then there are multiple test cases. For each test case there is one line containing two integers m and
Output
For each test case output one line represents the number of trees Farmer Sherlock can see.
Samples
2
1 1
2 3
1
5
Note
In case , trees in are visible. But tree in is invisible. The answer may exceed -bit integer. Please use long long int. The data used in this problem is unofficial data prepared by RedWall. So any mistake here does not imply mistake in the offcial judge data.
Resources
2009 Multi-University Training Contest 3 - Ho