Let's say you are standing on the XY-plane at point (0, 0) and you want to reach point (n, n).

You can move only in two directions: 

  * to the right, i. e. horizontally and in the direction that increase your x coordinate, 
  * or up, i. e. vertically and in the direction that increase your y coordinate. 



In other words, your path will have the following structure: 

  * initially, you choose to go to the right or up; 
  * then you go some positive integer distance in the chosen direction (distances can be chosen independently); 
  * after that you change your direction (from right to up, or from up to right) and repeat the process. 



You don't like to change your direction too much, so you will make no more than n - 1 direction changes.

As a result, your path will be a polygonal chain from (0, 0) to (n, n), consisting of at most n line segments where each segment has positive integer length and vertical and horizontal segments alternate.

Not all paths are equal. You have n integers c_1, c_2, ..., c_n where c_i is the cost of the i-th segment.

Using these costs we can define the cost of the path as the sum of lengths of the segments of this path multiplied by their cost, i. e. if the path consists of k segments (k ≤ n), then the cost of the path is equal to ∑_{i=1}^{k}{c_i ⋅ length_i} (segments are numbered from 1 to k in the order they are in the path).

Find the path of the minimum cost and print its cost.

Input

The first line contains the single integer t (1 ≤ t ≤ 1000) — the number of test cases.

The first line of each test case contains the single integer n (2 ≤ n ≤ 10^5).

The second line of each test case contains n integers c_1, c_2, ..., c_n (1 ≤ c_i ≤ 10^9) — the costs of each segment.

It's guaranteed that the total sum of n doesn't exceed 10^5.

Output

For each test case, print the minimum possible cost of the path from (0, 0) to (n, n) consisting of at most n alternating segments.

Example

Input


3
2
13 88
3
2 3 1
5
4 3 2 1 4


Output


202
13
19

Note

In the first test case, to reach (2, 2) you need to make at least one turn, so your path will consist of exactly 2 segments: one horizontal of length 2 and one vertical of length 2. The cost of the path will be equal to 2 ⋅ c_1 + 2 ⋅ c_2 = 26 + 176 = 202.

In the second test case, one of the optimal paths consists of 3 segments: the first segment of length 1, the second segment of length 3 and the third segment of length 2.

The cost of the path is 1 ⋅ 2 + 3 ⋅ 3 + 2 ⋅ 1 = 13.

In the third test case, one of the optimal paths consists of 4 segments: the first segment of length 1, the second one — 1, the third one — 4, the fourth one — 4. The cost of the path is 1 ⋅ 4 + 1 ⋅ 3 + 4 ⋅ 2 + 4 ⋅ 1 = 19.
// package eround101;

import java.util.*;
import java.io.*;
import java.lang.*;
import java.util.StringTokenizer;
import java.util.concurrent.TimeUnit;

public class C101 {

    static HritikScanner sc = new HritikScanner();
    static PrintWriter pw = new PrintWriter(System.out, true);
    final static int MOD = (int) 1e9 + 7;
    static StringBuilder sb = new StringBuilder();

    public static void main(String[] args) {

        int t = ni();
        while (t-- > 0) {
            solve();
        }
    }

     static void solve() {
        int n = ni();
        long[] arr = new long[n];
        for(int i = 0; i< n; i++)
        {
            arr[i] = nl();
        }
        long ae = 0;
        long ao = 0;
        long ans1 = 0, ans2 = 0, ans = Long.MAX_VALUE;
        long min1 = Long.MAX_VALUE, min2 = Long.MAX_VALUE;
        for(int i = 0; i< n; i++)
        {
            if(i % 2 == 0)
            {
                ae++;
                ans1 += arr[i];
                min1 = Math.min(min1, arr[i]);
            }
            if(i % 2 != 0)
            {
                ao++;
                ans2 += arr[i];
                min2 = Math.min(min2, arr[i]);
            }
            if(i > 0)
            {
                long v1 = ans1 + min1*(n-ae);
                long v2 = ans2 + min2*(n-ao);
                ans = Math.min(ans, v1+v2);
            }
        }
        pl(ans);
    }
    
    
    /////////////////////////////////////////////////////////////////////////////////
    static int[] nextIntArray(int n) {
        int[] arr = new int[n];
        int i = 0;
        while (i < n) {
            arr[i++] = ni();
        }
        return arr;
    }

    static long[] nextLongArray(int n) {
        long[] arr = new long[n];
        int i = 0;
        while (i < n) {
            arr[i++] = nl();
        }
        return arr;
    }

    static int[] nextIntArray1(int n) {
        int[] arr = new int[n + 1];
        int i = 1;
        while (i <= n) {
            arr[i++] = ni();
        }
        return arr;
    }

    /////////////////////////////////////////////////////////////////////////////////
    static int ni() {
        return sc.nextInt();
    }

    static long nl() {
        return sc.nextLong();
    }

    static double nd() {
        return sc.nextDouble();
    }

    /////////////////////////////////////////////////////////////////////////////////
    static void pl() {
        pw.println();
    }

    static void p(Object o) {
        pw.print(o+ " ");
    }

    static void pl(Object o) {
        pw.println(o);
    }

    static void psb(StringBuilder sb) {
        pw.print(sb);
    }

    static void pa(Object arr[]) {
        for (Object o : arr) {
            p(o);
        }
        pl();
    }

    static void pa(int arr[]) {
        for (int o : arr) {
            p(o);
        }
        pl();
    }

    static void pa(long arr[]) {
        for (long o : arr) {
            p(o);
        }
        pl();
    }

    static void pa(double arr[]) {
        for (double o : arr) {
            p(o);
        }
        pl();
    }

    static void pa(char arr[]) {
        for (char o : arr) {
            p(o);
        }
        pl();
    }

    static void pa(List list) {
        for (Object o : list) {
            p(o);
        }
        pl();
    }

    static void pa(Object[][] arr) {

        for (int i = 0; i < arr.length; ++i) {
            for (Object o : arr[i]) {
                p(o);
            }
            pl();
        }
    }

    static void pa(int[][] arr) {
        for (int i = 0; i < arr.length; ++i) {
            for (int o : arr[i]) {
                p(o);
            }
            pl();
        }
    }

    static void pa(long[][] arr) {
        for (int i = 0; i < arr.length; ++i) {
            for (long o : arr[i]) {
                p(o);
            }
            pl();
        }
    }

    static void pa(char[][] arr) {
        for (int i = 0; i < arr.length; ++i) {
            for (char o : arr[i]) {
                p(o);
            }
            pl();
        }
    }

    static void pa(double[][] arr) {
        for (int i = 0; i < arr.length; ++i) {
            for (double o : arr[i]) {
                p(o);
            }
            pl();
        }
    }

/////////////////////////////////////////////////////////////////////////////////
    static void print(Object s) {
        System.out.println(s);
    }

    /////////////////////////////////////////////////////////////////////////////////
    //-----------HritikScanner class for faster input----------//
    static class HritikScanner {

        BufferedReader br;
        StringTokenizer st;

        public HritikScanner() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }

        String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }
    }

    //////////////////////////////////////////////////////////////////
    public static class Pair implements Comparable<Pair> {

        int num, row,col;

        Pair(int num, int row, int col) {
            this.num = num;
            this.row = row;
            this.col = col;
        }

        public int get1() {
            return num;
        }

        public int get2() {
            return row;
        }

        public int compareTo(Pair A) {
            return this.num - A.num;
        }
        
        public String toString()
        {
            return num +" "+ row+" "+col;
        }
    }

    //////////////////////////////////////////////////////////////////
    // Function to return gcd of a and b time complexity O(log(a+b))
    static long gcd(long a, long b) {
        if (a == 0) {
            return b;
        }
        return gcd(b % a, a);
    }

    // method to return LCM of two numbers 
    static long lcm(int a, int b) {
        return (a / gcd(a, b)) * b;
    }

    //////////////////////////////////////////////////////////////////
    static boolean isPrime(long n) {
        // Corner cases 
        if (n <= 1) {
            return false;
        }
        if (n <= 3) {
            return true;
        }

        // This is checked so that we can skip  
        // middle five numbers in below loop 
        if (n % 2 == 0 || n % 3 == 0) {
            return false;
        }

        for (long i = 5; i * i <= n; i = i + 6) {
            if (n % i == 0 || n % (i + 2) == 0) {
                return false;
            }
        }

        return true;
    }
    //////////////////////////////////////////////////////////////////

    static boolean isPowerOfTwo(long n) {
        if (n == 0) {
            return false;
        }

        return (long) (Math.ceil((Math.log(n) / Math.log(2))))
                == (long) (Math.floor(((Math.log(n) / Math.log(2)))));
    }

    public static long getFact(int n) {
        long ans = 1;
        while (n > 0) {
            ans *= n;
            ans %= MOD;
            n--;
        }
        return ans;
    }

    public static long pow(long n, int pow) {
        if (pow == 0) {
            return 1;
        }
        long temp = pow(n, pow / 2) % MOD;
        temp *= temp;
        temp %= MOD;
        if (pow % 2 == 1) {
            temp *= n;
        }
        temp %= MOD;
        return temp;

    }

    public static long nCr(int n, int r) {
        long ans = 1;
        int temp = n - r;
        while (n > temp) {
            ans *= n;
            ans %= MOD;
            n--;
        }
        ans *= pow(getFact(r) % MOD, MOD - 2) % MOD;
        ans %= MOD;
        return ans;
    }

    //////////////////////////////////////////////////////////////////
    // method returns Nth power of A 
    static double nthRoot(int A, int N) {

        // intially guessing a random number between 
        // 0 and 9 
        double xPre = Math.random() % 10;

        // smaller eps, denotes more accuracy 
        double eps = 0.001;

        // initializing difference between two 
        // roots by INT_MAX 
        double delX = 2147483647;

        // xK denotes current value of x 
        double xK = 0.0;

        // loop untill we reach desired accuracy 
        while (delX > eps) {
            // calculating current value from previous 
            // value by newton's method 
            xK = ((N - 1.0) * xPre
                    + (double) A / Math.pow(xPre, N - 1)) / (double) N;
            delX = Math.abs(xK - xPre);
            xPre = xK;
        }

        return xK;
    }

}
