import java.io.{BufferedReader, InputStreamReader}

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

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)

    case class Memo(sumOfExpectation: Double, maxExpectation: Double)
    val memoes: mutable.HashMap[Int, Memo] = new mutable.HashMap()

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

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

      def expectation(aoki: Int): Double = {
        nextRooms.size match {
          case 0 => 0.0
          case 1 => nextRooms.head.expectation(aoki) + 1.0
          case size =>
            val memo = memoes.getOrElseUpdate(id,
              nextRooms.foldLeft[Memo](Memo(0.0, 0.0)) {
                case (Memo(sum, max), room) =>
                  val e = room.expectation(n)
                  Memo(sum + e, Math.max(e, max))
              }
            )
            if (id == aoki) {
              (memo.sumOfExpectation - memo.maxExpectation) / (size - 1) + 1.0
            } else if (id < aoki) {
              nextRooms.foldLeft[Double](0.0) {
                case (sum, room) =>
                  sum + room.expectation(aoki)
              } / size + 1.0
            } else {
                memo.sumOfExpectation / size + 1.0
            }
        }
      }

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

    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))
      }
    }

    val minE = (1 until n).foldLeft(Double.MaxValue) {
      case (e, aoki) => Math.min(rooms.head.expectation(aoki), e)
    }

//    System.err.println("----------------")
//
//    (1 until n).foreach { aoki =>
//      System.err.println("---[" + aoki + "]")
//      rooms.foreach { room =>
//        System.err.println(" " + room.id + " -> (" + room.nextRooms.map(_.id).sorted.mkString(",") + "), " + room.expectation(aoki))
//      }
//    }

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