After years of laying bricks, you have been asked to analyze how unstable a brick wall is. The instability of a wall is approximated by the largest damage the wall takes when one brick is pulled out.
A brick falls when every brick that was directly underneath it is gone. If the space under a brick is only partly empty, the brick does not fall. A brick that has fallen no longer holds up the bricks above it, so a collapse spreads. The bricks in the bottom row sit on the ground and never fall.
Given the layout of every brick in a wall, find the instability of the wall.
The input contains several test cases. The first line of each test case holds the height M and the width N of the wall. (1≤M,N≤100)
Each of the next M lines is a string of N digits describing one row of the wall. The first of those lines is the top row of the wall and the M-th one is the row that touches the ground. Inside a row, one brick is written as a substring whose digits are all the same and equal to its length. For example, 333 and 22 are one brick of length 3 and one brick of length 2, while 111 is three bricks of length 1. The digit 0 means that place of the wall is empty. Every brick has height 1.
The input ends with a line containing 0 0. The input is always correct, so both of the following hold.
For each test case, print on one line the largest total length of the bricks that fall when one brick is pulled out. The length of the brick that was pulled out counts toward the total.