BETA
School Problem's Submission isn't counted in score!

Submissions: 2475 Accuracy:

28.44%

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 Input/Output Examples Use 'Expected Output' option **

Contributor: karan kumar

Set Default Code

					   
It is recommended to 'Compile & Test' your code before clicking 'Submit'!

Compilation/Execution Result:

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