#C14463. Matrix Diagonal Difference

    ID: 44115 Type: Default 1000ms 256MiB

Matrix Diagonal Difference

Matrix Diagonal Difference

Given a square matrix \(A\) of size \(n \times n\), your task is to compute the absolute difference between the sums of its primary diagonal and secondary diagonal.

The primary diagonal is formed by the elements \(A[i][i]\) for \(0 \leq i \lt n\), and the secondary diagonal by the elements \(A[i][n-1-i]\) for \(0 \leq i \lt n\). The result is given by:

\[ |\sum_{i=0}^{n-1} A[i][i] - \sum_{i=0}^{n-1} A[i][n-1-i]| \]

Please ensure your program reads the input from stdin and writes the result to stdout.

inputFormat

The first line contains an integer \(n\) representing the size of the matrix. The following \(n\) lines each contain \(n\) space-separated integers representing a row of the matrix.

For example:

3
11 2 4
4 5 6
10 8 -12

outputFormat

Output a single integer representing the absolute difference between the sums of the matrix's diagonals.

## sample
3
11 2 4
4 5 6
10 8 -12
15