#DPJ. Sushi

Sushi

Score : 100100 points

Problem Statement

There are NN dishes, numbered 1,2,,N1, 2, \ldots, N. Initially, for each ii (1iN1 \leq i \leq N), Dish ii has aia_i (1ai31 \leq a_i \leq 3) pieces of sushi on it.

Taro will perform the following operation repeatedly until all the pieces of sushi are eaten:

  • Roll a die that shows the numbers 1,2,,N1, 2, \ldots, N with equal probabilities, and let ii be the outcome. If there are some pieces of sushi on Dish ii, eat one of them; if there is none, do nothing.

Find the expected number of times the operation is performed before all the pieces of sushi are eaten.

Constraints

  • All values in input are integers.
  • 1N3001 \leq N \leq 300
  • 1ai31 \leq a_i \leq 3

Input

Input is given from Standard Input in the following format:

NN

a1a_1 a2a_2 \ldots aNa_N

Output

Print the expected number of times the operation is performed before all the pieces of sushi are eaten. The output is considered correct when the relative difference is not greater than 10910^{-9}.

3
1 1 1
5.5

The expected number of operations before the first piece of sushi is eaten, is 11. After that, the expected number of operations before the second sushi is eaten, is 1.51.5. After that, the expected number of operations before the third sushi is eaten, is 33. Thus, the expected total number of operations is 1+1.5+3=5.51 + 1.5 + 3 = 5.5.

1
3
3

Outputs such as 3.00, 3.000000003 and 2.999999997 will also be accepted.

2
1 2
4.5
10
1 3 2 3 3 2 3 2 1 3
54.48064457488221