eolymp
bolt
Try our new interface for solving problems
Problems

Diagonals

Diagonals

In the square table $n \cdot n$ find the sum of integers at the main and the secondary diagonals. \InputFile The first line contains the size $n~(1 \le n \le 500)$ of the matrix. The next lines describe a matrix $n \cdot n$. The elements of the matrix are not greater than $10^5$ by absolute value. \OutputFile Print the sum of the integers at the main and the secondary diagonals. \includegraphics{https://static.eolymp.com/content/p5/p5qcfc9kep5fb8jfqq9ac5ehqs.gif}
Time limit 1 second
Memory limit 128 MiB
Input example #1
4
1 2 3 4
5 6 7 8
3 2 5 4
8 7 9 3
Output example #1
15 21