## GUPTA MECHANICAL

IN THIS WEBSITE I CAN TELL ALL ABOUT TECH. TIPS AND TRICKS APP REVIEWS AND UNBOXINGS ALSO TECH. NEWS .............

## [Solution] Score High CodeChef Solution | CodeChef Problem Solution 2022

Chef is taking a tough examination. The question paper consists of $N$ objective problems and each problem has $4$ options $A,B,C,$ and $D$, out of which, exactly one option is correct.

Since Chef did not study for the exam, he does not know the answer to any of the problems. Chef was looking nearby for help when his friend somehow communicated the following information:

• Exactly ${N}_{A}$ problems have option $A$ as the answer.
• Exactly ${N}_{B}$ problems have option $B$ as the answer.
• Exactly ${N}_{C}$ problems have option $C$ as the answer.

• Exactly ${N}_{D}$ problems have option $D$ as the answer.

Note that:

• ${N}_{A}+{N}_{B}+{N}_{C}+{N}_{D}=N$.
• Each problem is worth exactly $1$ mark and there is no negative marking.
• Even though Chef knows the number of correct options of each type, he does not know the correct answer to any problem.

Based on the given information, find the maximum marks Chef can guarantee if he marks the

## Bidding CodeChef Solution Pass the Exam CodeChef SolutionChef and Candies CodeChef SolutionJourney of the Knight CodeChef SolutionSlow Solution CodeChef Solution Game of Piles Version 1 CodeChef SolutionFind A, B, C CodeChef SolutionLargest Square in the garden CodeChef SolutionGame of Piles Version 2 CodeChef Solution

### Input Format

• First line will contain $T$, number of test cases. Then the test cases follow.
• First line of each test case contains an integer $N$ denoting the number of problems.
• Second line of each test case contains $4$ integers ${N}_{A},{N}_{B},{N}_{C},$ and ${N}_{D}$ - as mentioned in the problem statement.

### Output Format

For each test case, output the maximum marks Chef can guarantee if he marks the answers optimally.

### Constraints

• $1\le T\le 1000$
• $1\le N\le {10}^{5}$
• $0\le {N}_{A},{N}_{B},{N}_{C},{N}_{D}\le N$