#d1802. 吃蛋糕

吃蛋糕

Eating Cakes

Problem Description

There are nn plates, numbered 1,2,…,n1, 2, \dots, n. The ii-th plate holds aia_i (1≤ai≤31 \le a_i \le 3) cakes. Little N will eat cakes according to the following rule, until all cakes are eaten:

Each time, he picks one of the nn plates uniformly at random. Suppose plate ii is chosen. If plate ii still has cakes, he eats one; if plate ii has no cakes, he does nothing.

Find the expected number of times he needs to eat all the cakes.

Input Format

The first line contains an integer nn.

The next line contains nn integers a1,a2,…,ana_1, a_2, \dots, a_n.

Output Format

Output the expected number of times needed to eat all the cakes. An absolute or relative error within 10−910^{-9} is considered correct.

Sample Input

2
1 2

Sample Output

4.5

Constraints

For all data, 1≤n≤300,1≤ai≤31\le n\le 300, 1 \le a_i \le 3.