Author: | A. Verkholat | Time limit: | 1 sec | |
Input file: | Standard input | Memory limit: | 256 Mb | |
Output file: | Standard output |
Given an empty string.
You can add to that string characters 'A', 'B' and 'C'.
Your should calculate maximum score you can get with a string of length N.
First line contains an integer T - number of tests.
Each test contains four integers: N, Sa, Sb and Sc.
For each test print one integer - maximum score.
1≤T≤104
1≤N,Sa,Sb,Sc≤109
No. | Standard input | Standard output |
---|---|---|
1 |
|
|