using System;
using System.Collections.Generic;
using CompLib.Util;

public class Program
{
    private int N, M;
    private List<E>[] Edge;

    public void Solve()
    {
        var sc = new Scanner();
        N = sc.NextInt();
        M = sc.NextInt();
        Edge = new List<E>[N];
        for (int i = 0; i < N; i++)
        {
            Edge[i] = new List<E>();
        }

        for (int i = 0; i < M; i++)
        {
            int s = sc.NextInt() - 1;
            int t = sc.NextInt() - 1;
            Edge[s].Add(new E(t, i));
        }

        // 塞ぐ辺の候補
        List<int> ls = new List<int>();
        // 現在地、塞いだか?
        var dp = new double[N];

        dp[N - 1] = 0;

        for (int i = N - 2; i >= 0; i--)
        {
            double max = double.MinValue;
            int num = -1;
            int cnt = 0;
            double sum = 0;
            foreach (var e in Edge[i])
            {
                sum += dp[e.To];
                cnt++;
                if (max < dp[e.To])
                {
                    max = dp[e.To];
                    num = e.Num;
                }
            }

            dp[i] = 1.0 + sum / cnt;
            ls.Add(num);
        }

        double ans = dp[0];

        foreach (int l in ls)
        {
            var dp2 = new double[N];
            dp2[N - 1] = 0;
            bool f = true;
            for (int i = N - 2; i >= 0; i--)
            {
                double sum = 0;
                int cnt = 0;
                foreach (E e in Edge[i])
                {
                    if (e.Num == l) continue;
                    sum += dp2[e.To];
                    cnt++;
                }

                if (cnt == 0)
                {
                    f = false;
                    break;
                }

                dp2[i] = 1.0 + sum / cnt;
            }

            if (f)
                ans = Math.Min(ans, dp2[0]);
        }

        Console.WriteLine(ans);
    }

    public static void Main(string[] args) => new Program().Solve();
}

struct E
{
    public int To, Num;

    public E(int t, int n)
    {
        To = t;
        Num = n;
    }
}

namespace CompLib.Util
{
    using System;
    using System.Linq;

    class Scanner
    {
        private string[] _line;
        private int _index;
        private const char Separator = ' ';

        public Scanner()
        {
            _line = new string[0];
            _index = 0;
        }

        public string Next()
        {
            while (_index >= _line.Length)
            {
                _line = Console.ReadLine().Split(Separator);
                _index = 0;
            }

            return _line[_index++];
        }

        public int NextInt() => int.Parse(Next());
        public long NextLong() => long.Parse(Next());
        public double NextDouble() => double.Parse(Next());
        public decimal NextDecimal() => decimal.Parse(Next());
        public char NextChar() => Next()[0];
        public char[] NextCharArray() => Next().ToCharArray();

        public string[] Array()
        {
            _line = Console.ReadLine().Split(Separator);
            _index = _line.Length;
            return _line;
        }

        public int[] IntArray() => Array().Select(int.Parse).ToArray();
        public long[] LongArray() => Array().Select(long.Parse).ToArray();
        public double[] DoubleArray() => Array().Select(double.Parse).ToArray();
        public decimal[] DecimalArray() => Array().Select(decimal.Parse).ToArray();
    }
}

Measured memory_bytes: 20020