#include<bits/stdc++.h>
using namespace std;
typedef long long ll;

double dp[101][101][101];

double f(int a, int b, int c){
  if(dp[a][b][c])
    return dp[a][b][c];
  if(a==100||b==100||c==100)
    return 0;
  double ans=0;
  ans += (f(a+1,b,c)+1)*a/(a+b+c);
  ans += (f(a,b+1,c)+1)*b/(a+b+c);
  ans += (f(a,b,c+1)+1)*c/(a+b+c);
  dp[a][b][c] = ans;
  return ans;
}

int main() {
  int a,b,c;
  cin >> a >> b >> c;
  
  
  cout << fixed << setprecision(9) << f(a,b,c) << endl;
  
  return 0;
}
#include <bits/stdc++.h>
#define pb push_back
#define all(a) a.begin(),a.end()
#define forn(i,n) for(int i=0;i<int(n);i++)
#define forr(i,n) for(int i=int(n-1);i>=0;i--)
#define fora(i,a,b) for(int i=int(a);i<=int(b);i++)
#define forb(i,a,b) for(int i=int(a);i>=int(b);i--)
#define mod 1000000007
using namespace std;
using ll=long long int;
typedef vector<int> vi;
typedef pair<int,int> pi;
typedef vector<ll> vii;
typedef pair<ll ,ll> pii;

vector<tuple<int,int,int> > v;
int dis(tuple<int,int,int> p, tuple<int,int,int> q)
{
    int a=get<0>(p),b=get<1>(p),c=get<2>(p);
    int x=get<0>(q),y=get<1>(q),z=get<2>(q);
    int ans=abs(x-a)+abs(y-b)+max(0,z-c);
    return ans;
}
int dp[18][1<<18];
void init()
{
    for(int i=0;i<18;i++)
    {
        for(int j=0;j<(1<<18);j++)
        {
            dp[i][j]=-1;
        }
    }
}
int go(int mask,int n,int cur)
{
    if(mask==0)
    {
        return dis(v[cur],v[0]);
    }
    int &x=dp[cur][mask];
    if(x!=-1)return x;
    int ans=INT_MAX;
    forn(i,n)
    {
        if((mask&(1<<i)))
        {
            int cost=0;
            cost = dis(v[cur],v[i]);
            ans=min(ans,cost+go(mask^(1<<i),n,i));
        }
    }
    return x=ans;
}
void solve()
{
    init();
    int n;
    cin>>n;
    int mask=(1<<n)-1;
    forn(i,n)
    {
        int a,b,c;
        cin>>a>>b>>c;
        v.pb({a,b,c});
    }
    cout<<go(mask,n,0);

    
}

int main()
{
    ios::sync_with_stdio(0); 
    cin.tie(0); 
    cout.tie(0);
    int t=1;
    //cin>>t;
    while(t--)
	solve();
    return 0;
}