#include using namespace std; double c[110][110][110] = {}; void dp(int n, int *a) { c[n][n][n] = 0; for (int i=n; i>=0; i--) { for (int j=n; j>=0; j--) { for (int k=n; k>=0; k--) { if (k>=n) { continue; } c[i][j][k] = 1.0*n/(n-k); if (i!=n) c[i][j][k] += c[i+1][j][k]*(n-i)/(n-k); if (i!=j) c[i][j][k] += c[i][j+1][k]*(i-j)/(n-k); if (j!=k) c[i][j][k] += c[i][j][k+1]*(j-k)/(n-k); } } } } int main() { int n, x; cin >> n; int a[4] = {}; for (int i=0; i> x; if (x>3) { a[3]++; } else if (x!=0) { a[x]++; } } for (int i=2; i>0; i--) { a[i] += a[i+1]; } dp(n, a); cout << c[a[1]][a[2]][a[3]] << '\n'; }