The United Galactic Federation has constructed the Quantum Corridor, a massive linear particle accelerator consisting of $$$n$$$ discrete energy chambers indexed from $$$1$$$ to $$$n$$$.
You are the lead physicist overseeing an experiment with a single Chronon particle currently stabilized in chamber $$$i$$$. Due to the corridor's unique resonance, the Chronon travels exclusively by tunneling, instantly teleporting from its current position to a new one. The tunneling drive operates in two modes:
The containment field is strictly bounded by the corridor's physical dimensions. A tunnel is only successful if the destination chamber $$$x$$$ satisfies $$$1 \le x \le n$$$. If a jump attempts to land the particle outside this range, the field suppresses the move, and the Chronon remains in its current chamber.
The Chronon possesses infinite energy and can perform any sequence of valid jumps. However, the specific geometry of the corridor and the jump lengths may render certain sections of the accelerator permanently inaccessible.
Your task is to calculate the number of Dark Chambers, defined as the number of indices in the range $$$[1, n]$$$ that the Chronon can never reach, regardless of the sequence of moves attempted.
The first line contains a single integer $$$Q$$$ ($$$1 \le Q \le 10^5$$$), the number of test cases.
Each of the next $$$Q$$$ lines contains four space-separated integers: $$$n$$$, $$$i$$$, $$$a$$$, and $$$b$$$. Here, $$$n$$$ ($$$1 \le n \le 10^9$$$) represents the total number of chambers, $$$i$$$ ($$$1 \le i \le n$$$) is the starting chamber, $$$a$$$ ($$$1 \le a \le 10^9$$$) is the length of the Alpha Shift, and $$$b$$$ ($$$1 \le b \le 10^9$$$) is the length of the Beta Shift.
For each test case, output a single integer on a new line representing the count of unreachable chambers.
29 3 3 615 10 1 17
60