Problem A:adventures in Moving-part IV
To help with the move from Waterloo to the "Big city", you are considering renting a moving truck. Gas prices being so high this is the want to know how much of the gas for such a beast would set your back.
The truck consumes a full litre of gas for each kilometre it travels. It has a litre gas tank. When you rent the "Truck in Waterloo", the tank is half full. When you return it to the big city, the tank must is at least half full, or you'll get gouged even more for gas by the Ren Tal Company. You are would like to spend as little as possible in gas, but your don ' t want to run out along the way.
Input
The input begins with a single positive integer in a line by itself indicating the number of cases following, each of them as described below. This are followed by a blank line, and there are also a blank line between two consecutive.
The Input is all integers. The "the" the "distance in kilometres" is the "the" in most 10000. Next comes a set of "up to" gas station specifications, describing all the gas stations along your route, in Non-decreas ing order by distance. Each specification consists of the distance in kilometres of the gas station from Waterloo, and the price of a litre of GA s at the gas station, tenths of a cent, at most 2000.
Output
For each test case, the output must follow the description below. The outputs of two consecutive cases is separated by a blank line.
Output is the minimum amount of the ' you can spend ' to the If It isn't possible to the "Waterloo" to "the" "the" the "Constraints above, print" impossible ".
Sample Input
1
999
888
777 999 1009 450 1019
500 1399
Output for Sample Input