The city of Byteland is rectangular in shape and can be represented as a 2D coordinate system with columns and rows. At each of the intersections, there is a house. The top left house of the city is situated at coordinate and the bottom right house is situated at . The town hall is situated at the coordinate which contains a cell tower providing wireless network signal to all the houses in Byteland. Judges will be moving to Byteland soon. Wireless signal travels in a straight line and it gets weakened only if the signal has to travel straight through another house, judges want to choose a house in such a way that their devices receive maximum possible signal strength.
Can you tell me how many different houses meet judges’ requirements?
Note: Judges can not move to the town hall as the mayor lives there. The width and length of the houses are so small that you can ignore them.
The first line of the input will contain a single integer , denoting the number of test cases.
The next lines will contain four integers each.
It is guaranteed that sum of in all the test cases doesn’t exceed
For each test case, print an integer containing the answer.
3 1 1 0 0 2 3 1 1 4 4 1 1
0 5 12
In the first case, there are no houses available.
In the second case, all houses but the town hall meets the requirements. In the third case, 12 houses meet the requirements
Login to submit
A house will have maximum signal strength if the signal doesn’t have to travel through another house...