import java.io.{BufferedReader, InputStreamReader}

import scala.collection.mutable.ListBuffer

class Room(val id: Int) {
  val nextRooms: ListBuffer[Room] = new ListBuffer[Room]
  var memo: Option[Double] = None

  def addNext(next: Room): Room = {
    nextRooms += next
    this
  }

  def expectation(aoki: Int): Double = {
    memo match {
      case Some(e) => e
      case None =>
        val e = nextRooms.size match {
          case 0 => 0.0
          case 1 => nextRooms.head.expectation(aoki) + 1.0
          case size =>
            if (id == aoki) {
              nextRooms.map(_.expectation(aoki)).sorted.reverse.tail.sum / (size - 1) + 1.0
            } else {
              nextRooms.map(_.expectation(aoki)).sum / size + 1.0
            }
        }
        memo = Some(e)
        e
    }
  }

  def forget(): Unit = {
    memo = None
  }

  override def toString: String = {
    "[" + id + " -> (" + nextRooms.map(_.id).sorted.mkString(",") + ")]"
  }
}


object Main {
  def main(args: Array[String]): Unit = {
    val in = new BufferedReader(new InputStreamReader(System.in))
    val Array(n, m) = in.readLine().split("\\s+").map(_.toInt)

    val rooms = (1 to n).map(new Room(_)).toArray

    (1 to m).foreach { _ =>
      in.readLine().split("\\s+").map(_.toInt) match {
        case Array(s, t) => rooms(s - 1).addNext(rooms(t - 1))
      }
    }

//    System.err.println("------")

    val minE = (1 until n).map { aoki =>
      val e = rooms.head.expectation(aoki)
      rooms.foreach(_.forget())
      e
    }.min

//    rooms.foreach { room =>
//      System.err.println(room)
//    }

    System.out.println(f"$minE%2.10f")
  }
}
