The first line contains two space separated integers n and m (1≤n,m≤500), the size of the grid. At least one of n and m is greater than 1.
Each of the next n lines contains m digits with no spaces. Every digit is between 0 and 9, inclusive.
The first character of the first line is the top left square, and the last character of the last line is the bottom right square.