Amazing ------- Maria is preparing for the American Competition of Mazes (ACM). Contestants have to solve mazes such as ******1*** *23141231* *2******7* *12312311* ******2*** Each maze has a single entrance at the top and a single exit at the bottom. A maze may have multiple paths from the entrance to the exit. Contestants have to find a path with the smallest cost (the cost of a path is the sum of the integers that make up the path). For the above example, the smallest cost is 1 + 2 + 3 + 1 + 7 + 1 + 1 + 3 + 2 = 21. As Maria is preparing for the competition, she is solving more and more complex mazes. Her dad has great difficulty checking if her solutions are correct. Can you help by writing a program that takes a maze as input and produces the smallest cost? Input ----- The input may contain multiple test cases. The first line of each test case contains two integers R (3 <= R <= 1000), and C (3 <= C <= 1000) where R indicates the number of rows of the maze and C represents the number of columns of the maze. The next R lines each contain a row of the maze. Each row consists of C characters. The first and last character are always a *. The remaining characters can either be a digit or a *. The first and the last row only contains a single character different from *. The input will terminate with two zeros for R and C. Output ------ For each maze in the input, print the smallest cost. If no path from the entrance to the exit exists, print impossible. Sample Input ------------ 5 10 ******1*** *23141231* *2******7* *12312311* ******2*** 3 3 *1* *** *8* 0 0 Sample Output ------------- 21 impossible