You have to help a thief to steal as many as GoldCoins as possible from a GoldMine. There he saw N Gold Boxes an each Gold Boxes consists of Ai Plates each plates consists of Aj Gold Coins, Each Box consist of plates with exactly same number of GoldCoins per plate. Your task is to print the maximum gold coins theif can steal.
First line consists of T test cases. Each test case consists of three lines.
First line of each test case consistss of an Integer nT denoting the number of plates theif can steal.
Second line of each test case consists of an Integer N denoting the number of Gold Boxes available in the gold mine.
Third line of each test case consists of 2*N spaced Integers Ai,Aj dentoning number of plates in each box and number of gold coins in each plates respectively.
Print the respective result in each line.
1 3 2 2 3 1
If you have purchased any course from GeeksforGeeks then please ask your doubt on course discussion forum. You will get quick replies from GFG Moderators there.