410430: GYM104021 B So Easy

Memory Limit:512 MB Time Limit:1 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

B. So Easytime limit per test1 secondmemory limit per test512 megabytesinputstandard inputoutputstandard output

Mr. G invents a new game whose rules are given as follows.

Firstly, he has a $$$n \times n$$$ matrix, all elements of which are $$$0$$$ initially. Then, he follows up with some operations: in each time he chooses a row or a column, and adds an arbitrary positive integer to all the elements in the selected row or column. When all operations have been finished, he hides an element in the matrix and the element is modified to $$$-1$$$.

Now given the final matrix, you are asked to find out what the hidden element should be before the very last hiding operation.

Input

The first line contains a single integer $$$n~(2 \leq n \leq 1000)$$$.

Next $$$n$$$ lines represent the matrix after the operations. Each element in the matrix satisfies $$$-1 \leq a_{i,j} \leq 1000000$$$, and exactly one element is $$$-1$$$.

Output

Output a single integer, the hidden element.

ExampleInput
3
1 2 1
0 -1 0
0 1 0
Output
1

加入题单

上一题 下一题 算法标签: