Charlie is desperate to improve his programming skills.
Starting fresh, he can work hard and gain $$$a$$$ skill points per day for $$$x$$$ consecutive days, after which he is tired. For as long as he carries on tired, he will gain $$$b$$$ skill points per day. Alternatively, he can choose at any time to take a break of $$$y$$$ consecutive days, after which he can start afresh.
There are only $$$n$$$ days available before the big contest, and Charlie starts fresh on day $$$1$$$. Help him find the maximum skill points obtainable.
The first line of input contains the number of cases, $$$t$$$ ($$$1 \le t \le 10,000$$$).
Each test case consists of five integers $$$n,a,b,x,y,$$$ ($$$1 \le n \le 10^9$$$): the number of available days, ($$$10^9 \ge a \ge b \ge 1$$$) the daily skill points when fresh or tired, ($$$1 \le x, y \le 10^9$$$) the numbers of days of higher skill gain and break.
For each test case, output a single integer representing the maximum skill points obtainable.
62 2 2 2 24 4 2 3 35 3 2 3 15 4 1 3 199 80 40 30 510 6 1 6 1
4 14 13 16 7120 54
31 1 1 1 1100000000 100000000 100000000 100000000 10000000091965976 48437754 31825605 1671338 8268468
1 10000000000000000 2954637341500842