#include using namespace std; typedef pair P; typedef long long ll; typedef vector vi; typedef vector vll; #define pb push_back #define mp make_pair #define eps 1e-9 #define INF 2000000000 #define LLINF 1000000000000000ll #define sz(x) ((int)(x).size()) #define fi first #define sec second #define all(x) (x).begin(),(x).end() #define sq(x) ((x)*(x)) #define rep(i,n) for(int (i)=0;(i)<(int)(n);(i)++) #define repn(i,a,n) for(int (i)=(a);(i)<(int)(n);(i)++) #define EQ(a,b) (abs((a)-(b)) void chmin(T& a,const T& b){if(a>b)a=b;} template void chmax(T& a,const T& b){if(a ostream& operator << (ostream& os,pair& p){ os << p.fi << ',' << p.sec; return os; } template istream& operator >> (istream& is,pair& p){ is >> p.fi >> p.sec; return is; } template ostream& operator << (ostream &os,const vector &vec){ for(int i=0;i istream& operator >> (istream &is,vector& vec){ for(int i=0;i> vec[i]; return is; } void fastio(){ cin.tie(0); ios::sync_with_stdio(0); cout<x+y+z)t += rec(x+1,y,z)*(double)(N-x-y-z)/(double)N; if(x>0)t += rec(x-1,y+1,z)*(double)x/(double)N; if(y>0)t += rec(x,y-1,z+1)*(double)y/(double)N; t /= (1.0-(double)z/(double)N); // cout << x << ' ' << y << ' ' << z << ' ' << t << endl; return t; } int cnt[4]; int main(){ fastio(); cin >> N; for(int i=0;i> a[i]; cnt[min(a[i],3)]++; } for(int i=0;i<=100;i++){ for(int j=0;j<=100;j++){ for(int k=0;k<=100;k++){ dp[i][j][k] = -1.0; } } } dp[0][0][N] = 0.0; cout << rec(cnt[1],cnt[2],cnt[3]) << endl; return 0; }