#include <iostream>
#include <iomanip>
#include <complex>
#include <vector>
#include <algorithm>
#include <cmath>
#include <array>
using namespace std;
const double EPS = 1e-8;
const double INF = 1e12;
#define EQ(n,m) (abs((n)-(m)) < EPS)
#define X real()
#define Y imag()

typedef complex<double> P;
typedef vector<P> VP;
struct L : array<P, 2>{
    L(const P& a, const P& b){ at(0)=a; at(1)=b; }
    L(){}
};
namespace std{
    bool operator < (const P& a, const P& b){
        return (a.X!=b.X) ? a.X<b.X : a.Y<b.Y;
    }
    bool operator == (const P& a, const P& b){
        return abs(a-b) < EPS;
    }
}

double dot(P a, P b){
    return (conj(a)*b).X;
}
double cross(P a, P b){
    return (conj(a)*b).Y;
}
int ccw(P a, P b, P c){
    b -= a;
    c -= a;
    if(cross(b,c) > EPS) return +1; //ccw
    if(cross(b,c) < -EPS) return -1; //cw
    if(dot(b,c) < -EPS) return +2; //c-a-b
    if(abs(c)-abs(b) > EPS) return -2; //a-b-c
    return 0; //a-c-b
}
P unit(const P &p){
    return p/abs(p);
}

P crosspointLL(const L &l, const L &m) {
  double A = cross(l[1]-l[0], m[1]-m[0]);
  double B = cross(l[1]-l[0], l[1]-m[0]);
  return m[0] + B/A *(m[1]-m[0]);
}

int main(){
    while(1){
        int n;
        cin >> n;
        if(n==0) break;

        vector<double> len(n);
        for(int i=0; i<n; i++){
            cin >> len[i];
        }
        vector<bool> choose(n, false);
        for(int i=0; i<3; i++){
            choose[n-i-1] = true;
        }

        double ans = 0;
        do{
            //底面を作る3角形の選び方
            vector<double> base;
            for(int i=0; i<n; i++){
                if(choose[i]) base.push_back(len[i]);
            }
            sort(base.begin(), base.end());
            if(base[0] +base[1] < base[2] +EPS) continue;

            P p[3];
            p[0] = P(0, 0);
            p[1] = P(base[0], 0);
            double c2x = (base[2]*base[2] -base[1]*base[1] +base[0]*base[0]) /(2*base[0]);
            double c2y = sqrt(base[2]*base[2] -c2x*c2x);
            p[2] = P(c2x, c2y);

            //底面から生やす辺の選び方
            for(int i=0; i<n; i++){
                if(choose[i]) continue;
                for(int j=0; j<n; j++){
                    if(choose[j] || j==i) continue;
                    for(int k=0; k<n; k++){
                        if(choose[k] || k==i || k==j) continue;
                        //3角形が作れるか
                        bool ok = true;
                        double hlen[3] = {len[i], len[j], len[k]};
                        L lines[3];
                        for(int d=0; d<3; d++){
                            if(hlen[d] +hlen[(d+1)%3] < base[d] || abs(hlen[d] -hlen[(d+1)%3]) > base[d]){
                                ok = false;
                                break;
                            }
                            double dist = (hlen[d]*hlen[d] -hlen[(d+1)%3]*hlen[(d+1)%3] +base[d]*base[d]) /(2*base[d]);
                            P dir = dist * unit(p[(d+1)%3] -p[d]);
                            lines[d][0] = p[d] +dir;
                            lines[d][1] = lines[d][0] +dir *P(0, 1);
                        }
                        if(ok){
                            P cp1 = crosspointLL(lines[0], lines[1]);
                            double h = sqrt(hlen[0]*hlen[0] -norm(cp1));
                            ans = max(ans, cross(p[1], p[2]) *h /6);
                        }
                    }
                }
            }
        }while(next_permutation(choose.begin(), choose.end()));

        cout << fixed << setprecision(10);
        cout << ans << endl;
    }
    return 0;
}



Measured memory_bytes: 3368