fun main(args: Array<String>) {
  val (N, M) = readLine()!!.split(" ").map { it.toInt() }
  val st = (0..N).map { mutableSetOf<Int>() }
  for (i in 0 until M) {
    val (s, t) = readLine()!!.split(" ").map { it.toInt() }
    st[s].add(t)
  }
  val ts = (0..N).map { mutableSetOf<Int>() }
  for (s in 1..N) {
    st[s].forEach { t -> ts[t].add(s) }
  }
//  println(st)
//  println(ts)

  var min = Double.MAX_VALUE
  for (j in N - 1 downTo 1) {
    val dp = (0..N).map { 0.0 }.toMutableList()
    for (i in N downTo 1) {
      var set = st[i]
      if (i == j && set.size > 1) {
        val index = set.maxBy { dp[it] }
        index?.let {
          set = set.toMutableSet()
          set.remove(it)
//          println("remove $i to $it")
        }
      }
      dp[i] = set.sumByDouble { (dp[it] + 1) / set.size }
    }
//    println(dp)
    min = Math.min(min, dp[1])
  }
  println(min)
}
