import scala.collection.mutable.Map
import scala.io.StdIn

object Main {
  def main(args: Array[String]) = {
    val N = StdIn.readLine.toInt
    val N_inv = 1.0 / N.toDouble
    val INIT = Map(1 -> 0,2 -> 0,3 -> 0)
    for (i <- StdIn.readLine.split(" ").map(_.toInt)) INIT(i) = INIT(i)+1
    val DP = Array.fill(2,N+2,N+2,N+2)(0.0)
    DP(0)(INIT(1))(INIT(2))(INIT(3)) = 1.0

    var cnt = 1.0
    var mean = 0.0
    for (l <- 1 until 50*N) {
      DP((l-1)%2)(0)(0)(0) = 0.0
      for {
        i <- 0 to N
        j <- 0 to N
        k <- 0 to N
      } {
        val prev = (l-1)%2
        var calc = DP(prev)(i)(j)(k)*(N-i-j-k) + DP(prev)(i+1)(j)(k)*(i+1)
        if (i > 0) calc = calc + DP(prev)(i-1)(j+1)(k)*(j+1)
        if (j > 0) calc = calc + DP(prev)(i)(j-1)(k+1)*(k+1)
        DP(l%2)(i)(j)(k) = calc*N_inv
      }
      mean = mean + DP(l%2)(0)(0)(0)*cnt
      cnt =  cnt + 1.0
    }

    println(mean)
  }
}
