import java.io.*;
import java.util.*;

public class casino_dk_stupid {
    final int MAXN = 500000;

    long[] p = new long[MAXN + 1];

    public void solve() throws IOException {
        int t = nextInt();
        whi: while (t-- > 0) {
            int n = nextInt();
            int[] a = new int[n + 1];
            for (int i = 1; i <= n; i++) {
                a[i] = nextInt();
            }
            int[] p = new int [n];
            for (int i = 0; i < n; i++) {
                p[i] = i + 1;
            }
            double max = 0;
            do {
                double cur = 0;
                boolean[] f = new boolean[n + 2];
                f[0] = f[n + 1] = true;
                for (int i = 0; i < n; i++) {
                    if (!f[p[i] - 1] && !f[p[i] + 1]) {
                        cur += (a[p[i] - 1] + a[p[i] + 1] + .0) / 2.0;
                    }
                    if (f[p[i] - 1] && !f[p[i] + 1]) {
                        cur += a[p[i] + 1];
                    }
                    if (!f[p[i] - 1] && f[p[i] + 1]) {
                        cur += a[p[i] - 1];
                    }
                    f[p[i]] = true;
                }
                max = Math.max(max, cur);
            } while (nextPermutation(p));
            out.println(max);
        }
    }


    void run() throws IOException {
        //br = new BufferedReader(new InputStreamReader(System.in));
        //out = new PrintWriter(System.out);
        br = new BufferedReader(new FileReader("casino.in"));
        out = new PrintWriter("casino.out");
        solve();
        out.close();
    }

    BufferedReader br;
    PrintWriter out;
    StringTokenizer stok;

    String nextToken() throws IOException {
        while (stok == null || !stok.hasMoreTokens()) {
            String s = br.readLine();
            if (s == null) {
                return null;
            }
            stok = new StringTokenizer(s);
        }
        return stok.nextToken();
    }

    int nextInt() throws IOException {
        return Integer.parseInt(nextToken());
    }

    long nextLong() throws IOException {
        return Long.parseLong(nextToken());
    }

    double nextDouble() throws IOException {
        return Double.parseDouble(nextToken());
    }

    char nextChar() throws IOException {
        return (char) (br.read());
    }

    String nextLine() throws IOException {
        return br.readLine();
    }

    public static void main(String[] args) throws IOException {
        new casino_dk_stupid().run();
    }


    public class RmqSparseTable {

        int[] logTable;
        int[][] rmq;
        int[] a;

        public RmqSparseTable(int[] a) {
            this.a = a;
            int n = a.length;

            logTable = new int[n + 1];
            for (int i = 2; i <= n; i++)
                logTable[i] = logTable[i >> 1] + 1;

            rmq = new int[logTable[n] + 1][n];

            for (int i = 0; i < n; ++i)
                rmq[0][i] = i;

            for (int k = 1; (1 << k) < n; ++k) {
                for (int i = 0; i + (1 << k) <= n; i++) {
                    int x = rmq[k - 1][i];
                    int y = rmq[k - 1][i + (1 << k - 1)];
                    rmq[k][i] = a[x] >= a[y] ? x : y;
                }
            }
        }

        public int max(int i, int j) {
            int k = logTable[j - i];
            int x = rmq[k][i];
            int y = rmq[k][j - (1 << k) + 1];
            return a[x] >= a[y] ? a[x] : a[y];
        }
    }

    public static boolean nextPermutation(int[] p) {
        for (int a = p.length - 2; a >= 0; --a)
            if (p[a] < p[a + 1])
                for (int b = p.length - 1; ; --b)
                    if (p[b] > p[a]) {
                        int t = p[a];
                        p[a] = p[b];
                        p[b] = t;
                        for (++a, b = p.length - 1; a < b; ++a, --b) {
                            t = p[a];
                            p[a] = p[b];
                            p[b] = t;
                        }
                        return true;
                    }
        return false;
    }

}
