Matrix of size n \times m is given, consisting of only zeros and ones. Find the largest square submatrix that contains on its sides ones only.
First line contains two integers and ( ≤ , ≤ ). Each of the next lines contains digits and space separated.
Print one integer – the size of maximal square that contains on its sides ones only. If there are no such squares, print .
Example 1
Example 2
Example 3