Competitions
PP2. Week 4: March 29 - April 4
Diagonals
In the square table n × n find the sum of integers at the main and at the secondary diagonal.
Input
First line contains the size n (1 ≤ n ≤ 500) of the matrix. Next lines describe a matrix n × n. The elements of the matrix are not greater than 105
by absolute value. To understand how each diagonal is called, look at the second sample.
Output
Print the sum of integers at main and secondary diagonal.
Input example #1
1 451
Output example #1
451 451
Input example #2
4 134 475 30 424 303 151 419 235 248 166 90 42 318 237 184 36
Output example #2
411 1327