Problem: There are N dishes, numbered 1, 2, \ldots, N. Initially, for each i (1 \leq i \leq N), Dish i has a_i (1 \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, \ldots, N with equal probabilities, and let i be the outcome. If there are some pieces of sushi on Dish i, 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.
* 1 \leq N \leq 300
* 1 \leq a_i \leq 3

Input

Input is given from Standard Input in the following format:


N
a_1 a_2 \ldots a_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 10^{-9}.

Examples

Input

3
1 1 1


Output

5.5


Input

1
3


Output

3


Input

2
1 2


Output

4.5


Input

10
1 3 2 3 3 2 3 2 1 3


Output

54.48064457488221

Solution (in JAVA):

Solution:
//package atcoder.dpContest;

import java.io.*;
import java.util.*;

public class Main {
    private static double[][][] ev;
    private static double[][][] p;
    private static boolean[][][] visited;
    public static void main(String[] args) {
//        try {
//            FastScanner in = new FastScanner(new FileInputStream("src/input.in"));
//            PrintWriter out = new PrintWriter(new FileOutputStream("src/output.out"));

        FastScanner in = new FastScanner(System.in);
        PrintWriter out = new PrintWriter(System.out);

            solve(1, in, out);

//        } catch (IOException e) {
//            e.printStackTrace();
//        }
    }

    private static void solve(int q, FastScanner in, PrintWriter out) {
        for (int qq = 0; qq < q; qq++) {
            int N = in.nextInt();
            int[] a = new int[N];
            int sum = 0, ones = 0, twos = 0, threes = 0;
            for(int i = 0; i < N; i++) {
                a[i] = in.nextInt();
                sum += a[i];
                if(a[i] == 1) {
                    ones++;
                }
                else if(a[i] == 2) {
                    twos++;
                }
                else {
                    threes++;
                }
            }

            ev = new double[N + 1][N + 1][N + 1];    //ev[i][j][k]: the expected number of operations to go from state(i, j, k) to state(0, 0, 0)
            p = new double[N + 1][N + 1][N + 1];     //p[i][j][k]: the probability of getting from state(i, j, k) to state(0, 0, 0)
            visited = new boolean[N + 1][N + 1][N + 1];
            p[0][0][0] = 1.0;
            ev[0][0][0] = 0.0;
            visited[0][0][0] = true;

            out.println(sushiHelper(N, ones, twos, threes));
        }
        out.close();
    }

    private static double sushiHelper(int N, int ones, int twos, int threes) {
//        if(ones == 0 && twos == 0 && threes == 0) {
//            return ev[0][0][0];
//        }
        if(visited[ones][twos][threes]) {
            return ev[ones][twos][threes];
        }
        //there are N - ones - twos - threes empty dishes
        double p_waste = (double)(N - ones - twos - threes) / N;
        double ev_waste = p_waste / (1 - p_waste);
        ev[ones][twos][threes] += ev_waste;

        if(ones > 0) {
            ev[ones][twos][threes] += sushiHelper(N, ones - 1, twos, threes) * ones / (ones + twos + threes);
        }
        if(twos > 0) {
            ev[ones][twos][threes] += sushiHelper(N, ones + 1, twos - 1, threes) * twos / (ones + twos + threes);
        }
        if(threes > 0) {
            ev[ones][twos][threes] += sushiHelper(N, ones, twos + 1, threes - 1) * threes / (ones + twos + threes);
        }
        ev[ones][twos][threes] += 1;
        visited[ones][twos][threes] = true;
        return ev[ones][twos][threes];

//        double p_waste = (double)(N - ones - twos - threes) / N;
//        ev[ones][twos][threes] = 1 + ()
    }

    static class FastScanner {
        BufferedReader br;
        StringTokenizer st;

        FastScanner(InputStream stream) {
            try {
                br = new BufferedReader(new InputStreamReader(stream));
            } catch (Exception e) {
                e.printStackTrace();
            }
        }

        String next() {
            while (st == null || !st.hasMoreTokens()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }

        String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }
    }
}