import java.io.{BufferedReader, InputStreamReader}

import scala.collection.mutable
import scala.collection.mutable.ListBuffer

class Room(val id: Int) {
  val nextRooms: ListBuffer[Room] = new ListBuffer[Room]
  var memo: mutable.HashMap[Int, Double] = new mutable.HashMap()

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

  def expectation(aoki: Int): Double = {
    memo.getOrElseUpdate(aoki,
      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).foldLeft(Double.MaxValue) {
      case (e, aoki) => Math.min(rooms.head.expectation(aoki), e)
    }

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

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