#!/usr/bin/env python3 # %% import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines # %% N, *A = map(int, read().split()) # %% a = sum(x == 0 for x in A) b = sum(x == 1 for x in A) c = sum(x == 2 for x in A) # %% dp = [[[0] * (N + 2) for _ in range(N + 2)] for _ in range(N + 2)] for n in range(N + 1): for i in range(n + 1): for j in range(n + 1): if i == j == n == 0: continue k = n - i - j if k < 0: break x = N + i * dp[i - 1][j + 1][k] + j * dp[i][j - 1][k + 1] + k * dp[i][j][k - 1] dp[i][j][k] = x / (i + j + k) # %% print(dp[a][b][c])