Haebin saved up money from odd jobs while going to school and now wants to buy a car. A car can come with several options, but Haebin cannot add or multiply, so he asked his friend Taewan for help. Taewan cannot add or multiply either.
Compute for them how much the car costs once every option they want is included.
The first line contains the number of test cases.
The first line of each test case contains the price s of the car itself. (1≤s≤100000)
The second line contains the number n of distinct options Haebin wants to buy. (0≤n≤1000)
Each of the next n lines contains q and p. Here q is how many units of that option Haebin buys and p is the price of one unit of that option. (1≤q≤100, 1≤p≤10000)
For each test case, print the final price Haebin pays for the car, one per line.