Given a square matrix of size M×M. Your task is to calculate the sum of its diagonals.
The first line of input contains an integer T denoting the number of test cases. Then T test cases follow. First line of each test case contains a single integer M denoting the size of the square matrix. The next line contains M*M space separated values of the matrix A.
For each test case in a new line print the sum of diagonals of the matrix.
1 ≤ T ≤ 20
2 ≤ M ≤ 10
1 ≤ A[i] ≤ 20
1 1 1 1 1 1 1 1 1
If you have purchased any course from GeeksforGeeks then please ask your doubt on course discussion forum. You will get quick replies from GFG Moderators there.