Թաքցված խնդիր
|Այս խնդիրը թաքցված է խմբագրական խրհրդի անդամի կողմից քանի որ կամ այն ոչ ճիշտ լեզվով է գրված,|կամ թեստային տվյալներն են սխալ, կամ խնդրի ձևակերպումը պարզ չէ։|

## ACM_0038 - HOW MUCH

This financial crisis! Even MI6’s technology department does not escape the consequences. With all those constraints on the budget, how can R be expected to supply our spies with cars equipped with all the technological gadgets and weaponry they need to save the world? As if it is not hard enough to put all those tracking systems, oil sprayers, guns, bullets and missiles in one car, now R has to worry about the costs as well.

The management insists, though: before R is allowed to order a car and all the parts he needs, he will first need to determine the exact amount of money that he needs. Management will then decide whether he gets to realize his vision or not.

This sort of bureaucratic nonsense is not something that R wants to waste any time on. He therefore wants you to help him. Given the price of the car, a listing of the parts R wants to install, and the price per piece of each part, work out what the total cost is of the project.

#### Input

On the first line one positive number: the number of test cases, at most 100. After that per test case:

• one line with an integer s (1 s 100 000): the stock price of the car.
• one line with an integer n (0 n 1 000): the number of different parts to be installed.
• n lines with two space-separated integers qi and pi (1 qi 100 and 1 pi 10 000): for each different part i, the number of pieces qi required of such part, and the price pi for a single piece.

#### Output

Per test case:

• one line with an integer: the total amount of money needed to buy the car and all the parts.

#### Examples

 № stdin stdout 1 2 10000 2 1 2000 3 400 50000 0 13200 50000

 Ավելացրեց. Հրանտ Հովհաննիսյան Ամսաթիվ. 2013-12-21 Ժամանակի սահմանափակումը. 1s Ծրագրի տեքստի սահմանափակումը. 50000B Memory limit: 1536MB Cluster: Cube (Intel G860) Լեզուներ. Բոլորը բացի ASM32 ASM64 GAWK CLPS CLOJURE D ERL FSHARP FORTRAN GOSU HASK ICON ICK NEM NIM OBJC-CLANG PICO PIKE PYPY PY_NBC RUST SCM guile CHICKEN SED TCL WHITESPACE Աղբյուրը. Benelux Preliminary (BAPC) 2013.H