题目描述
Anmol loves Alupuri and can do anything for it. His best friend Bhavesh tells him that he will give him Alupuri treat if he successfully solve a problem. So his friend Bhavesh gave him a square matrix of size M×M, and asked him to calculate the difference between the sums of its diagonals.Since Anmol is very weak in maths so he needs your help to solve this problem and get Alupuri treat.
Input Format:
The first line contains a single integer M. The next M lines denote the matrix's rows, with each line containing M space-separated integers describing the columns.
Output Format:
Print the absolute difference between the two sums of the matrix's diagonals as a single integer.
Constraints:
3 ≤ M ≤ 100
SAMPLE INPUT
3
9 2 10
8 3 6
7 6 -4
SAMPLE OUTPUT
12
Explanation
The primary diagonal is:
9
3
-4
Sum across the primary diagonal: 9 + 3 - 4 = 8
The secondary diagonal is:
10
3
7
Sum across the secondary diagonal: 10+ 3 + 7 = 20
Difference: |8-20 | = 12
输入格式
见题面
输出格式
见题面