#include <cstdio>
#include <iostream>
#include <sstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <climits>
#include <cfloat>
using namespace std;

const double EPS = 1.0e-10;

double determinant(vector<vector<double> > mat)
{   
    const int n = mat.size();
    double ret = 1.0;
    for(int i=0; i<n; ++i){
        int tmp = i;
        for(int j=i+1; j<n; ++j){
            if(abs(mat[j][i]) > abs(mat[tmp][i]))
                tmp = j;
        }
        if(abs(mat[tmp][i]) < EPS)
            return 0.0;
        if(tmp != i){
            mat[i].swap(mat[tmp]);
            ret *= -1.0;
        }

        for(int j=i+1; j<n; ++j){
            for(int k=n-1; k>=i; --k){
                mat[j][k] -= mat[i][k] * (mat[j][i] / mat[i][i]);
            }
        }
        ret *= mat[i][i];
    }
    return ret;
}

double tetrahedronVolume(const vector<double>& len)
{
    const int a[][3] = {{0,1,3}, {1,2,4}, {0,2,5}, {3,4,5}};
    for(int i=0; i<4; ++i){
        vector<double> b(3);
        for(int j=0; j<3; ++j)
            b[j] = len[a[i][j]];
        sort(b.begin(), b.end());
        if(b[2] > b[0] + b[1] - EPS)
            return 0.0;
    }

    const int y[] = {0, 3, 1, 3, 2, 3, 0, 1, 1, 2, 0, 2};
    const int x[] = {3, 0, 3, 1, 3, 2, 1, 0, 2, 1, 2, 0};

    vector<vector<double> > mat(5, vector<double>(5, 1.0));
    for(int i=0; i<12; ++i)
        mat[y[i]][x[i]] = pow(len[i/2], 2.0);
    for(int i=0; i<5; ++i)
        mat[i][i] = 0.0;

    return sqrt(determinant(mat) / 288.0);
}

template <size_t T>
bool nextBitset(bitset<T> &bs, int digit)
{
    if(bs.none())
        return false;
    bitset<T> x, y, z;
    x = bs.to_ulong() & (~(bs.to_ulong()) + 1ULL);
    y = bs.to_ulong() + x.to_ulong() + 0ULL;
    z = bs & ~y;
    if(bs[digit-1] && bs == z)
        return false;
    bs = ((z.to_ulong() / x.to_ulong()) >> 1) + 0ULL;
    bs |= y;
    return true;
}

int main()
{
    for(;;){
        int n;
        cin >> n;
        if(n == 0)
            return 0;

        vector<double> len(n);
        for(int i=0; i<n; ++i)
            cin >> len[i];

        double ret = 0.0;
        bitset<15> used;
        for(int i=0; i<n; ++i){
            for(int j=0; j<i; ++j){
                for(int k=0; k<j; ++k){
                    used[i] = used[j] = used[k] = true;

                    for(int a=0; a<n; ++a){
                        for(int b=0; b<n; ++b){
                            for(int c=0; c<n; ++c){
                                if(a == b || b == c || c == a)
                                    continue;
                                if(used[a] || used[b] || used[c])
                                    continue;

                                vector<double> len2(6);
                                len2[0] = len[a];
                                len2[1] = len[b];
                                len2[2] = len[c];
                                len2[3] = len[i];
                                len2[4] = len[j];
                                len2[5] = len[k];
                                ret = max(ret, tetrahedronVolume(len2));
                                ;
                            }
                        }
                    }

                    used[i] = used[j] = used[k] = false;
                }
            }
        }

        printf("%.10f\n", ret);
    }
}

Measured memory_bytes: 1272