H :: Hitting the target
Time Limit: 1 Second Memory Limit: 65536 KB
Genius little Ali is in wonderland, where there are all these amazing, fantastic and adventure games! He has played all the trilling games, but he did not enjoy any. Since Ali is genius he loves intellectual games. While he was walking around, suddenly he noticed a nice challenging game and bought a ticket for it. In this game N seesaws are placed in a row and are numbered 1 to N from left to right. Two consecutive seesaws have a distance of 1 meter. Also there is a wooden cell 1 meter to the right of the rightmost seesaw. In this cell there is one million million ... Rials, as the prize of the one who manages to break the cell. The cell has a resistance of K, meaning that to break it, it must be hit with a stone weighting K or more.
Initially there is a stone of weight wi on the left side of i‐th seesaw. Ali can increase or decrease the weights of these stones arbitrary as long as the weight of the stone on each seesaw remains positive. Total cost of these changes is equal to sum of absolute differences of weight changes for all seesaws.
Input
The first line contains an integer T (T ≤ 100), the number of tests. In the first line of each test there will be three integers N, WS, K (1 ≤ N ≤ 1000, 1 ≤ WS, K ≤ 109), the number of seesaws, weight of the first dropping stone and the resistance of the wooden cell, respectively. The next line will consist of N weights wi (1 ≤ wi ≤ 109).
Output
For each test print the minimum cost of stone changes to break the wooden cell. If Ali cannot win the prize anyway, print “Impossible” instead. (Quotes for clarity)
Sample Input
3 5 123 1 130 23 119 20 34 3 2 2 3 2 1 4 80 1 77 82 76 1000
Sample Output
10 Impossible 1Submit
Source: AUT 2012