#include <vector>
#include <stack>
#include <queue>
#include <list>
#include <bitset>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <numeric>
#include <iostream>
#include <iomanip>
#include <string>
#include <chrono>
#include <random>
#include <cmath>
#include <cassert>
#include <climits>
#include <cstring>
#include <cstdlib>
#include <functional>
#include <sstream>

using namespace std;

class Solution {
public:
    long double solve(int n, vector<pair<int,int>>& edges) {
        vector<vector<int>> graph(n);

        for (auto& e : edges) {
            int u = e.first;
            int v = e.second;
            assert(u < v);
            graph[u].push_back(v);
        }

        int rt = 0;
        vector<int> ord(n, 0);
        iota(ord.begin(), ord.end(), 0);

        reverse(ord.begin(), ord.end());

        vector<vector<long double>> dp(n + 1, vector<long double>(2, 0));

        vector<long double> prefix(n + 1, 0);
        vector<long double> suffix(n + 1, 0);
        for (auto u : ord) {
            if (u == n - 1) {
                dp[u][0] = 0;
                dp[u][1] = 0;
                continue;
            }

            int m = graph[u].size();
            prefix[0] = 0;
            suffix[m] = 0;
            for (int i = 0; i < m; ++i) {
                int v = graph[u][i];
                prefix[i + 1] = prefix[i] + dp[v][0];
            }
            for (int i = m - 1; i >= 0; --i) {
                int v = graph[u][i];
                suffix[i] = suffix[i + 1] + dp[v][0];
            }

            dp[u][0] = suffix[0] / m + 1;

            dp[u][1] = dp[u][0];
            if (m == 1) {
                continue;
            }
            for (int i = 0; i < m; ++i) {
                int v = graph[u][i];
                long double ans = prefix[i] + suffix[i + 1];
                if (m - 1 > 0) {
                    dp[u][1] = min(dp[u][1], ans / (m - 1) + 1);
                }
            }
        }

        long double res = n + 12345;
        res = min(dp[rt][0], res);
        res = min(dp[rt][1], res);
        for (int i = 0; i < n; ++i) {
            vector<long double> P(n, 0);
            assert(dp[i][1] <= dp[i][0]);
            for (int j = 0; j < n; ++j) {
                if (i == j) {                    
                    P[j] = dp[j][1];
                } else {
                    P[j] = dp[j][0];
                }
            }
            for (int j = i - 1; j >= 0; --j) {
                int m = graph[j].size();
                long double ans = 0;
                for (int k : graph[j]) {
                    ans += P[k];
                }
                ans = ans / m + 1;
                P[j] = ans;
            }
            res = min(res, P[0]);
        }
        return res;
    }
};

int main(int argc, char** argv) {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(12);

    int n;
    int m;
    cin >> n >> m;
    vector<pair<int,int>> edges;
    for (int i = 0; i < m; ++i) {
        int u, v;
        cin >> u >> v;
        --u, --v;
        edges.emplace_back(u, v);
    }

    Solution sol;
    cout << sol.solve(n, edges) << "\n";

    return 0;
}

Measured memory_bytes: 2928