//
//  main.cpp
//  3
//
//  Created by RISHAV SINGH MEHTA on 18/03/21.
//

#include <iostream>
#include <cassert>
#include <limits>
#include <cmath>
#include <algorithm>
#include <vector>
#include <unordered_map>
#include <unordered_set>
#include <string>
#include <array>
#include <map>
#include <set>
#include <deque>
#include <list>
#include <chrono>
#include <sstream>
#include <iomanip>
#include <numeric>
#include <climits>
#include <cstring>
#include <bitset>
#include <stack>
#include <queue>
#define MOD 1000000007;
//using ll = int64_t;
using ull = uint64_t;
#define ll long long
using namespace std;

int main(int argc, const char * argv[]) {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    // insert code here...
    
    ll int n,i,j,k,K,l,a,b,c,N,M,T;
    cin>>T;
    
    while (T--) {
        cin>>N;
        vector<ll int> v,pre,lga,mn;
        v.push_back(0);
        lga.push_back(0);
        pre.push_back(0);
        mn.push_back(INT_MAX);
        for (i=0; i<N; i++) {
            cin>>a;
            v.push_back(a);
            if (mn.size()==1) {
                mn.push_back(a);
            }else{
                mn.push_back(min(a,mn[i-1]));
            }
            pre.push_back(pre.back() + a);
        }
        ll int ans=LLONG_MAX;
        for (i=1; i<=N; i++) {
            lga.push_back(pre[i-1] + v[i]*(N - (i-1)/2));
        }
        /*cout<<"mn = "<<endl;
        for (i=1; i<=N; i++) {
            cout<<mn[i]<<" ";
        }
        cout<<endl;
        cout<<"pre = "<<endl;
        for (i=1; i<=N; i++) {
            cout<<pre[i]<<" ";
        }
        cout<<endl;
        
        cout<<"lga = "<<endl;
        for (i=1; i<=N; i++) {
            cout<<lga[i]<<" ";
        }
        cout<<endl;*/
        for (i=2; i<=N; i++) {
            ans=min(ans,lga[i] + mn[i-1]*(N - (i)/2));
        }
        cout<<ans<<endl;
    }
    
}
