Once Andriy took part in a programming competition. The first prize was a valuable bag of candies. However, no matter how hard he tried to solve the last problem, he could not, so he turns to you for help.
You are given a matrix of size n \times m, where the intersection of the -th row and -th column is an element a_{i,j}. Rows are numbered from top to bottom from to , and columns from left to right from to . The upper left cell has coordinates . You need to find the maximum value of the bitwise AND of the numbers on the path from the upper left to the lower right cell of the matrix, if you can only move to the right or down (if they exist).
The symbol AND denotes the bitwise AND. The bitwise AND operation between two numbers and is defined on pairs of corresponding bits of the numbers: if both bits are equal to , then the bit in the answer at this position is equal to , otherwise — . For example, AND = AND = = .
The first line contains two integers and (1 \le n,m \le 10^3) — the number of rows and columns, respectively.
The next lines contain integers a_{i,j} (0 \le a_{i,j} < 2^{60}) — the values of the matrix elements.
Output one integer — the maximum value of the AND of elements on the path from the upper left to the lower right cell of the matrix.
Example 1
Example 2
Example 3
More about bitwise AND: http://bit.ly/3Whf2l6
Explanation for the first example:
There are two paths from the upper left cell to the lower right:
, , — The elements in these positions have values , , and , respectively. AND AND = 2.
, , — The elements in these positions have values , , and , respectively. AND AND = 0.
Explanation for the second example:
One of the possible paths is the path with the numbers highlighted in red. AND AND AND AND AND AND = 4.

Binary matrix in the second example
Solutions that work correctly for n \times m \le 25 will receive at least points.
Solutions that work correctly for a_{i,j} \le 32 will receive at least points.