@n = gets.to_f

a = gets.split.map(&:to_i)
c = [0,0,0,1]
3.times {|i| c[2-i] = c[3-i] + a.count(3-i)}

@memo = Array.new(c[0]) {Array.new(c[1]) {Array.new(c[2])}}
@memo[0][0][0] = 0.0

def calc(x, y, z)
    return @memo[x][y][z] if @memo[x][y][z]

    s = @n
    s += calc(x - 1, y, z) * x if x > 0
    s += calc(x + 1, y - 1, z) * y if y > 0
    s += calc(x, y + 1, z - 1) * z if z > 0
    @memo[x][y][z] = s / (x + y + z)
end

p calc(c[0] - c[1], c[1] - c[2], c[2] - 1)
