Max Trace#12280

Max Trace

1 second
128 megabytes
Medium

You are given a square matrix of side i.e. of n \times n size. You can select any square submatrix of the matrix and rotate it 90^{\circ} degrees clockwise. You can do this any number of times you want.

Find the maximum trace that we can achieve. Note that the trace of the matrix is the sum of the elements on the diagonal from to . We define the trace as the sum of the left diagonal integers from to , Formally :

\text{trace}=\sum_{i=1}^n a_{i,i}

Input

The first line contains a positive integer (1 \le t \le 100) — the number of test cases.

The first line of each test case contains an integer (1 \le n \le 1000), the side of the matrix.

The next lines follow, each having space separated integers a_{i,1},a_{i,2},...,a_{i,n} (1 \le a_{i,j} \le 10^{6}).

It is guaranteed that the sum of n^{2} over all the test cases doesn't exceed 10^{6}

Output

Output the maximum trace that you can achieve by applying the given operations.

Examples

Example 1

Loading
Loading

Scoring

  1. Subtask ( points) : No additional constraints