| Kotlin Heroes: Episode 14 |
|---|
| Finished |
You have two towers made of blocks, standing next to each other. Initially, the height of the first tower is $$$a$$$, and the height of the second tower is $$$b$$$.
In one action, you can:
Your goal is to make the height of the first tower equal to $$$c$$$, and the height of the second tower equal to $$$d$$$. What is the minimum number of actions you need to perform?
The first line contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases.
Each test case consists of one line containing $$$4$$$ integers $$$a, b, c, d$$$ ($$$1 \le a \le c \le 10^8$$$; $$$1 \le b \le d \le 10^8$$$).
For each test case, output one integer — the minimum number of actions that you have to perform.
51 2 3 51 1 1 12 6 3 83 3 6 42 4 7 7
40335
In the first example, you can first place a block on the first tower, making the heights of both towers equal to $$$2$$$. Then, you can place one block on each tower, raising their heights to $$$3$$$. After that, you can place two blocks on the second tower, increasing its height to $$$5$$$. Thus, in $$$4$$$ moves, you can make the height of the first tower equal to $$$3$$$ and the second tower equal to $$$5$$$.
| Name |
|---|


