1. Smart Kid You are a school student who is attending math class, and your teacher has asked everyone in class to bring a calculator so she could teach her class how to use one. The teacher decides that the first lesson would be, where she would tell a positive number and the students just have to type the exact number into the calculator. But, just as the class is about to begin you find that some of the numbers on the calculator are broken totally while some are working, and only the "multiplication" and "equal to" buttons are working. Since you are a smart kid, you decide that you still want to get to the number that the teacher has just told out loud, as quickly as possible with what you have. Example, if your teacher said the number 60 , and you can type 1, 2,5 only. You will push the buttons: 15 (2 clicks) multiplication (1 click) 2 (1 click) multiplication (1 click) 2 (1 click) equal to (1 click) which requires 7 clicks, but since you are smart you use: 12 (2 clicks), multiplication (1 click), 5 (1 click), equal to (1 click) which is just 5 clicks in all. You want to get to the number as fast as possible, so you derided to minimize the numher nf clirks needed to
get to that number! Input: The first line of input is the number of cases \( \mathbf{C} \). \( \mathbf{C} \) case descriptions follow Each case description will have two lines, the first line contains 10 numbers each of which is 0 or 1 only, the \( \boldsymbol{i}^{\text {th }} \) number - (starting from 0 ) is 1 if the number \( i \) can be clicked (meaning it is not broken) and 0 if it cannot be clicked. The second line in the case description contains the number \( \mathrm{N} \) which the teacher has just recited. (for clarification - you may refer the sample input) Output: For each case, output a line containing "Case #a: \( m \) " where \( a \) is the case number (starts with 1 ) and \( m \) is the minimum number of button clicks needed to get to that number. Of course in some cases you may never be able to get to that number, in which case you may print "Impossible". SaI110le: Input
Explanation: Case 1: Explained in the problem statement Case 2: Since all buttons are working you click 1, 2, 8 followed by equals Case 3: Only odd numbers are working - so you'll never be able to get to 128 You may assume that : \[ \begin{array}{l} 1<=C<=100 \\ 1<=N<=10^{6} \end{array} \]