N, M = gets.split.map(&:to_i)
G = Array.new(N + 1){ [] }
M.times do
  s,t = gets.split.map(&:to_i)
  G[s] << t
end
dp = Array.new(N + 1){ Array.new(N + 1, 0.0) }
(0 ... N).each do |i|
  (1 ... N).reverse_each do |s|
    if i != s || G[s].size == 1
      p0 = 1.0 / G[s].size
      G[s].each do |t|
        dp[i][s] += p0 * (dp[i][t] + 1.0)
      end
    else
      p1 = 1.0 / (G[s].size - 1)
      j = G[s].max_by{|t| dp[i][t] } 
      G[s].each do |t|
        dp[i][s] += p1 * (dp[i][t] + 1.0) unless t == j
      end
    end
  end
end
puts (0 ... N).map{|i| dp[i][1] }.min
