A. Standard Othman
time limit per test
1 second
memory limit per test
256 megabytes
input
standard input
output
standard output

Othman is a lazy student who relies entirely on leaked exam statistics to pass his high school national exams with a high score.

This morning, Othman is taking his final Biology exam, which consists of $$$100$$$ multiple-choice questions. Each question has four possible choices: a, b, c, and d.

By pure luck (or so he claims), Othman found out that among the $$$100$$$ questions, exactly $$$A$$$ questions have the correct answer a, $$$B$$$ questions have the correct answer b, $$$C$$$ questions have the correct answer c, and $$$D$$$ questions have the correct answer d. However, he has no idea which specific answer belongs to which question.

To make use of this information, Othman decides to mark exactly $$$A$$$ questions as a, $$$B$$$ questions as b, $$$C$$$ questions as c, and $$$D$$$ questions as d on his answer sheet.

Help Othman determine the maximum number of questions he is guaranteed to answer correctly, regardless of how the actual correct answers are arranged.

Input

The first line contains a single integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of test cases.

Each test case consists of a single line containing four non-negative integers $$$A$$$, $$$B$$$, $$$C$$$, and $$$D$$$ ($$$0 \le A, B, C, D \le 100$$$, $$$A + B + C + D = 100$$$) — the counts of options a, b, c, and d, respectively.

Output

For each test case, output a single integer — the maximum number of correct answers Othman is guaranteed to get in the worst-case scenario.

Example
Input
3
25 25 25 25
50 0 50 0
60 20 20 0
Output
0
0
20