#include <iostream>
#include <algorithm>
#include <utility>
#include <fstream>
#include <iomanip>
#include <complex>
#include <cmath>
#include <vector>
#include <cstring>
#include <string>
#include <sstream>
#include <map>
#include <set>
#include <queue>

#define IO ios::sync_with_stdio(0); cin.tie(NULL); cout.tie(NULL);
typedef long long ll;
typedef long double ld;
const ll INF = 1e18;
const int N = 3e2 + 5, inf = 1e9, mod = 998244353;
using namespace std;

int n, a, freq[4] = {};
ld dp[N][N][N] = {};
bool vis[N][N][N] = {};

ld solve ( int c1 , int c2 , int c3 )
{
    if ( c1 + c2 + c3 == 0 )
        return 0;
    if ( vis[c1][c2][c3] )
        return dp[c1][c2][c3];
    vis[c1][c2][c3] = true;
    ld ret = 1.0, c0 = n - ( c1 + c2 + c3 );
    if ( c1 )
        ret += solve ( c1 - 1 , c2 , c3 ) * ( 1.0 * c1 / n );
    if ( c2 )
        ret += solve ( c1 + 1 , c2 - 1 , c3 ) * ( 1.0 * c2 / n );
    if ( c3 )
        ret += solve ( c1 , c2 + 1 , c3 - 1 ) * ( 1.0 * c3 / n );
    ret /= ( 1 - ( c0 / n ) );
    return dp[c1][c2][c3] = ret;
}

int main()
{
    IO
    cin >> n;
    for(int i = 0; i < n; i++)
    {
        cin >> a;
        freq[a]++;
    }
    cout << fixed << setprecision(10) << solve( freq[1] , freq[2] , freq[3] ) << '\n';
    return 0;
}
#include <bits/stdc++.h>
using namespace std;

#define ll long long
#define ull unsigned long long 
#define endl '\n'
//const int MOD = 1e9+7;

bool ok(int a, int b, int c, int d, vector<char> s){
    int ans=0;
    if(s[1]=='+')
        ans = a+b;
    else
        ans = a-b;
    
    if(s[3]=='+')
        ans = ans + c;
    else
        ans = ans-c;

    if(s[5]=='+')
        ans += d;
    else
        ans -= d;
    
    if(ans==7)
        return true;
    else
        return false;
}

int main(){
    string s;
    cin >> s;
    int a=s[0]-'0';
    int b=s[1]-'0';
    int c=s[2]-'0';
    int d=s[3]-'0';
    

    char sign[2] = {'+', '-'};
    vector<char> ans(7);
    ans[0]=s[0];
    ans[2]=s[1];
    ans[4]=s[2];
    ans[6]=s[3];
    
    for(int i=0; i<2; ++i){
        for(int j=0; j<2; ++j){
            for(int k=0; k<2; ++k){
                ans[1]=char(sign[i]);
                ans[3]=char(sign[j]);
                ans[5]=char(sign[k]);
                if(ok(a,b,c,d,ans)){
                    for(auto x:ans)
                        cout << x;
                    cout << "=7";
                    return 0;
                }
            }
        }
    }
}
