import java.io.{BufferedReader, InputStreamReader}

import scala.collection.mutable.ListBuffer

class Room(val id: Int) {
  val nextRooms: ListBuffer[Room] = new ListBuffer[Room]

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

  def expectation(aoki: Int): Double = {
    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
        }
    }
  }

  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 =>
      rooms.head.expectation(aoki)
    }.min

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

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