TSUCE's final exams are over! The grading teacher, Big K, looked at Little T's horrible exam paper.
Therefore, he decided to use the following tricks to save Little T, who scored $$$x$$$ points:
Please help Big K find a valid way to use these tricks so that Little T can obtain the maximum possible score.
The first line contains a single integer $$$T$$$ ($$$1 \le T \le 3 \times 10^5$$$), representing the number of test cases.
Each test case consists of a single line containing 5 integers $$$x$$$, $$$a_1$$$, $$$a_2$$$, $$$a_3$$$, $$$a_4$$$ ($$$1 \le x \le 100, 0 \le a_1, a_2, a_3, a_4 \le 400$$$), representing Little T's initial score and the maximum number of times Big K can use each trick.
For each test case, output a single line with an integer representing the maximum score Little T can obtain.
71 1 1 1 150 2 1 1 299 0 1 2 110 2 0 0 3100 400 400 400 40075 1 7 3 01 3 7 4 3
70 118 148 71 98703086085238798121046930830507710 168 232
For the 1st test case, Little T initially scored $$$1$$$ point, and Big K can use each trick at most once. Big K can adopt the following strategy:
| Name |
|---|


