#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #define popcount __builtin_popcount using namespace std; typedef long long ll; typedef pair P; int n; double memo[101][101][101]; double solve(int x, int y, int z){ if(x==0 && y==0 && z==0) return 0; if(memo[x][y][z]) return memo[x][y][z]; double ret=0; if(x) ret+=(double)x/(double)(x+y+z)*((double)(n-y-z)/(double)x+solve(x-1, y+1, z)); if(y) ret+=(double)y/(double)(x+y+z)*((double)(n-x-z)/(double)y+solve(x, y-1, z+1)); if(z) ret+=(double)z/(double)(x+y+z)*((double)(n-x-y)/(double)z+solve(x, y, z-1)); return memo[x][y][z]=ret; } int main() { cin>>n; int a[110]; int x=0, y=0, z=0; for(int i=0; i>a[i]; if(a[i]==0) x++; else if(a[i]==1) y++; else if(a[i]==2) z++; } printf("%.7lf\n", solve(x, y, z)); return 0; }