BETA
This is a school problem. Successful submissions of this are not counted in user ratings.

Submissions : 2323 Accuracy :

27.08

Diagonal sum
     

Given a square matrix of size M×M . Your task is to calculate the sum of its diagonals.

Input:
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.

Output:
For each test case in a new line print the sum of diagonals of the matrix.

Constraints:
1 ≤ T ≤ 20
2 ≤ N ≤ 10
1 ≤ A[i] ≤ 20

Example:

Input:

1
3
1 1 1 1 1 1 1 1 1

Output:
6

**For More Examples Use Expected Output**


Contributor: karan kumar

Set Default Code

					   
Result:
It is recommended to test your code before clicking 'Submit' button!



                   



Need help with your code? Please use ide.geeksforgeeks.org, generate link and share the link here.