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
import java.util.*;

import java.io.*;
import java.math.BigInteger;

public class Main {
	FastScanner in;
	PrintWriter out;
	boolean systemIO = true;

	public long pow(long x, long p, long mod) {
		if (p <= 0) {
			return 1;
		}
		long th = pow(x, p / 2, mod);
		th *= th;
		th %= mod;
		if (p % 2 == 1) {
			th *= x;
		}
		return th;
	}

	public class Fraction implements Comparable<Fraction> {
		long x;
		long y;

		public Fraction(long x, long y) {
			this.x = x;
			this.y = y;
		}

		public void norm() {
			long gcd = gcd(x, y);
			x /= gcd;
			y /= gcd;
		}

		@Override
		public int compareTo(Fraction o) {
			if (x > o.x) {
				return 1;
			}
			if (x < o.x) {
				return -1;
			}
			if (y > o.y) {
				return 1;
			}
			if (y < o.y) {
				return -1;
			}
			return 0;
		}
	}

	public Fraction sum(Fraction a, Fraction b) {
		Fraction c = new Fraction(a.x * b.y + a.y * b.x, a.y * b.y);
		c.norm();
		return c;
	}

	public long gcd(long x, long y) {
		if (y == 0) {
			return x;
		}
		if (x == 0) {
			return y;
		}
		return gcd(y, x % y);
	}

	public class Pair implements Comparable<Pair> {
		long x;
		long y;

		public Pair(long x, long y) {
			this.x = x;
			this.y = y;
		}

		@Override
		public int compareTo(Pair o) {
			// if (x != o.x) {
			// return x - o.x;
			// }
			// return y - o.y;
			return 0;
		}
	}

	// public class Vertex {
	// Vertex father;
	// Vertex l;
	// Vertex r;
	// int sz;
	// long y;
	// long x;
	// int time;
	// int mintime;
	// int value;
	//
	// public Vertex(Vertex father, Vertex l, Vertex r, int sz, long y, long x, int
	// time, int mintime, int value) {
	// this.father = father;
	// this.l = l;
	// this.r = r;
	// this.sz = sz;
	// this.y = y;
	// this.x = x;
	// this.time = time;
	// this.mintime = mintime;
	// this.value = value;
	// }
	//
	// public Vertex(long x, int time, int value) {
	// this.father = null;
	// this.l = null;
	// this.r = null;
	// this.sz = 1;
	// this.y = random.nextLong();
	// this.x = x;
	// this.time = time;
	// this.mintime = time;
	// this.value = value;
	// }
	//
	// public void update() {
	// sz = 1;
	// mintime = time;
	// if (l != null) {
	// sz += l.sz;
	// mintime = Math.min(time, mintime);
	// }
	// if (r != null) {
	// sz += r.sz;
	// mintime = Math.min(time, mintime);
	// }
	// }
	// }
	//
	// public void add0(Vertex v, Vertex v1, Vertex father) {
	// if (v == null) {
	// v1.father = father;
	// father.r = v1;
	// father.update();
	// return;
	// }
	// if (v.y >= v1.y) {
	// add0(v.r, v1, v);
	// father.update();
	// return;
	// }
	// father.r = v1;
	// v1.father = father;
	// v.father = v1;
	// v1.l = v;
	// v1.update();
	// father.update();
	// }
	//
	// public Vertex pop(Vertex v, Vertex father, int h) {
	// if (v.l == null) {
	// if (h == 0) {
	// father.r = v.r;
	// } else {
	// father.l = v.r;
	// }
	// if (v.r != null) {
	// v.r.father = father;
	// v.r.update();
	// }
	// father.update();
	// v.father = null;
	// v.r = null;
	// v.update();
	// return v;
	// }
	// Vertex ans = pop(v.l, v, h + 1);
	// father.update();
	// return ans;
	// }
	//
	// public void cut(Vertex rl, Vertex rr, Vertex v, int mint) {
	//
	// }
	//
	// public int push(Vertex v, Vertex v1, Vertex father, boolean rson, int szl) {
	//
	// }
	//
	// Vertex root0;

	// public class State implements Comparable<State> {
	// int[] a;
	//
	// public State(int[] a) {
	// this.a = a;
	// }
	//
	// @Override
	// public int compareTo(State o) {
	// for (int i = 0; i < a.length; i++) {
	// if (a[i] != o.a[i]) {
	// return a[i] - o.a[i];
	// }
	// }
	// return 0;
	// }
	// }

	long mod = 1000000007;
	int n;

	public void solve() {
		n = in.nextInt();
		int[] a = new int[4];
		for (int i = 0; i < n; i++) {
			a[in.nextInt()]++;
		}
		long time = System.currentTimeMillis();
//		n = 300;
		double[][][] dp = new double[n + 1][n + 1][n + 1];
		System.err.println(System.currentTimeMillis() - time);
		int c = 0;
		for (int sum = 0; sum < dp.length; sum++) {
			for (int i = 0; i <= sum; i++) {
				for (int j = 0; i + j <= sum; j++) {
					c++;
					int[] th = { n - sum, sum - i - j, j, i };
					if (th[1] + th[2] + th[3] > 0) {
						dp[th[1]][th[2]][th[3]] += 1.0 * th[0] / (n - th[0]);
					}
					if (th[0] > 0) {
						dp[th[1] + 1][th[2]][th[3]] += (dp[th[1]][th[2]][th[3]] + 1) * (th[1] + 1)
								/ (th[1] + 1 + th[2] + th[3]);
					}
					if (th[1] > 0) {
						dp[th[1] - 1][th[2] + 1][th[3]] += (dp[th[1]][th[2]][th[3]] + 1) * (th[2] + 1)
								/ (th[1] + th[2] + th[3]);
					}
					if (th[2] > 0) {
						dp[th[1]][th[2] - 1][th[3] + 1] += (dp[th[1]][th[2]][th[3]] + 1) * (th[3] + 1)
								/ (th[1] + th[2] + th[3]);
					}
				}
			}
		}
		out.print(dp[a[1]][a[2]][a[3]]);
		System.err.println(c);
		System.err.println(System.currentTimeMillis() - time);
	}

	// public long convert(int[] th) {
	// long ans = 0;
	// for (int i = 0; i < th.length; i++) {
	// ans *= n;
	// ans += th[i];
	// }
	// return ans;
	// }
	//
	// public int[] convert(long x) {
	// int[] th = new int[4];
	// th[3] = (int) (x % n);
	// x /= n;
	// th[2] = (int) (x % n);
	// x /= n;
	// th[1] = (int) (x % n);
	// x /= n;
	// th[0] = (int) (x % n);
	// return th;
	// }
	//
	// long mod = 1000000007;
	// int n;
	//
	// public void solve() {
	// n = in.nextInt();
	// int[] a = new int[4];
	// for (int i = 0; i < n; i++) {
	// a[in.nextInt()]++;
	// }
	// long time = System.currentTimeMillis();
	//// n = 300;
	// n++;
	// double[][][] dp = new double[n][n][n];
	// System.err.println(System.currentTimeMillis() - time);
	// TreeSet<Long> set = new TreeSet<>();
	// int[] st = {n - 1, 0, 0, 0};
	// set.add(convert(st));
	// int c = 0;
	// while (!set.isEmpty()) {
	// c++;
	// int[] th = convert(set.pollLast());
	// if (th[1] + th[2] + th[3] > 0) {
	// dp[th[1]][th[2]][th[3]] += 1.0 * th[0] / (n - th[0]);
	// }
	// if (th[0] > 0) {
	// dp[th[1] + 1][th[2]][th[3]] += (dp[th[1]][th[2]][th[3]] + 1) * (th[1] + 1) /
	// (th[1] + 1 + th[2] + th[3]);
	// int[] s = {th[0] - 1, th[1] + 1, th[2], th[3]};
	// set.add(convert(s));
	// }
	// if (th[1] > 0) {
	// dp[th[1] - 1][th[2] + 1][th[3]] += (dp[th[1]][th[2]][th[3]] + 1) * (th[2] +
	// 1) / (th[1] + th[2] + th[3]);
	// int[] s = {th[0], th[1] - 1, th[2] + 1, th[3]};
	// set.add(convert(s));
	// }
	// if (th[2] > 0) {
	// dp[th[1]][th[2] - 1][th[3] + 1] += (dp[th[1]][th[2]][th[3]] + 1) * (th[3] +
	// 1) / (th[1] + th[2] + th[3]);
	// int[] s = {th[0], th[1], th[2] - 1, th[3] + 1};
	// set.add(convert(s));
	// }
	// }
	// out.print(dp[a[1]][a[2]][a[3]]);
	// System.err.println(c);
	// System.err.println(System.currentTimeMillis() - time);
	// }

	public void solve1() {
		String s = in.next();
		String t = in.next();
		int[][] ans = new int[s.length() + 1][t.length() + 1];
		for (int i = 0; i < ans.length - 1; i++) {
			for (int j = 0; j < ans[0].length - 1; j++) {
				if (s.charAt(i) == t.charAt(j)) {
					ans[i + 1][j + 1] = ans[i][j] + 1;
				}
			}
		}
		String answer = "";
		for (int i = 0; i < ans.length; i++) {
			for (int j = 0; j < ans[0].length; j++) {
				if (ans[i][j] > answer.length()) {
					answer = s.substring(i - ans[i][j], i);
				}
			}
		}
		out.print(answer);
	}

	public void run() {
		try {
			if (systemIO) {
				in = new FastScanner(System.in);
				out = new PrintWriter(System.out);
			} else {
				in = new FastScanner(new File("input.txt"));
				out = new PrintWriter(new File("output.txt"));
			}
			solve();

			out.close();
		} catch (IOException e) {
			e.printStackTrace();
		}
	}

	class FastScanner {
		BufferedReader br;
		StringTokenizer st;

		FastScanner(File f) {
			try {
				br = new BufferedReader(new FileReader(f));
			} catch (FileNotFoundException e) {
				e.printStackTrace();
			}
		}

		FastScanner(InputStream f) {
			br = new BufferedReader(new InputStreamReader(f));
		}

		String nextLine() {
			try {
				return br.readLine();
			} catch (IOException e) {
				return null;
			}
		}

		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());
		}

	}

	// AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA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