The medical team from Bitland has arrived at their destination --- a city named Matrix which is suffering from COVID-19. Now they are going to distribute the manpower to the place in need properly.
The Matrix city has only horizontal and vertical roads, dividing the city into separated blocks. That is, you can consider the blocks in this city form a real matrix of
rows and
columns!
The COVID-19 is now spreading among the blocks, which has infected many innocent people. xyjj, the captain of the team, now needs to consider how may medical workers should be sent to each block. If we note the number of patients in the blocks of row and
as
, and the number of medical workers sent to that block as
, the basic rule of the arrangement will be as follows:
Here means any different rows and
means any different column.
Because the life expenses of the workers are covered by the local block, xyjj hopes that the maximum number of workers to be sent to each block to be minimum (That is, minimize the among all the blocks) , so there will be less financial pressure for that block.
xyjj is too busy to solve this problem, can you help him?
The first line contains an integer
, indicating that Matrix city has
rows and
columns of blocks.
In the next
lines, each line has
numbers. The
-th number in the
-th line represents the number
--- the number of patients in the block of the
-th row and
-th column in the Matrix city.
A integer represents the minimum possible maximum number of workers required to be sent to one block.