#include <iostream>
#include <vector>
#include <set>
#include <queue>
#include <map>
#include <cassert>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <limits>
#include <math.h>
#define REP(i,n) for(ll i=0, i##_len=(n); i<i##_len; ++i)
#define RREP(i,n) for(ll i=(n)-1; i>=0; --i)
#define SREP(i,s,n) for(ll i=(s), i##_len=(n); i<i##_len; ++i)


using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;

template <typename T>
T gcd(T a, T b) {
    if(a < b) gcd(b, a);
    if (b == 1) return 1;
    T r;
    while ((r=a%b)) {
        a = b;
        b = r;
    }
    return b;
}

bool comp(pair<ll, ll> a, pair<ll, ll> b) {
    return a.second > b.second;
}

struct UnionFind {
    vector<int> par;
    vector<int> rank;
    
    UnionFind(int n = 1) {
        init(n);
    }
    
    void init(int n = 1) {
        par.resize(n); rank.resize(n);
        for (int i = 0; i < n; ++i) {
            par[i] = i;
            rank[i] = 0;
        }
    }
    
    int root(int x) {
        if (par[x] == x) {
            return x;
        }
        else {
            int r = root(par[x]);
            return par[x] = r;
        }
    }
    
    bool issame(int x, int y) {
        return root(x) == root(y);
    }
    
    bool merge(int x, int y) {
        x = root(x); y = root(y);
        if (x == y) return false;
        if (rank[x] < rank[y]) swap(x, y);
        if (rank[x] == rank[y]) ++rank[x];
        par[y] = x;
        return true;
    }
};

#define MOD (1000000007)

void square(vector<vector<double>> I1, vector<vector<double>> &I2, vector<vector<double>> &O) {
    REP(i, I1.size()) {
        REP(j, I1.size()) {
            double a = 0;
            REP(k, I1.size()) {
                a += I1[i][k]*I2[k][j];
            }
            O[i][j] = a;
        }
    }
}

int main(int argc, const char * argv[]) {
    cin.tie(0);
    ios::sync_with_stdio(false);

    int N, M;
    cin >> N >> M;
    vector<pair<int, int>> st(M);
    vector<vector<int>> in(N), out(N);
    REP(i, M) {
        cin >> st[i].first >> st[i].second;
        st[i].first--;
        st[i].second--;
        in[st[i].second].push_back(st[i].first);
        out[st[i].first].push_back(st[i].second);
    }
    
    vector<double> cdp(N, 0);
    RREP(i, N) {
        REP(j, in[i].size()) {
            cdp[in[i][j]] += (cdp[i]+1)*1.0/out[in[i][j]].size();
        }
    }
    
    double minE = 1e12;
    REP(k, N) {
        pair<int, int> bl = make_pair(N-1, N-1);
        if (out[k].size()>1) {
            double wE = 0;
            REP(j, out[k].size()) {
                if (wE < cdp[out[k][j]]) {
                    wE = cdp[out[k][j]];
                    bl.first = k;
                    bl.second = out[k][j];
                }
            }
        }
        
        vector<double> dp(N, 0);
        RREP(i, N) {
            REP(j, in[i].size()) {
                if (bl.first == in[i][j] && out[bl.first].size() > 1) {
                    if (bl.second != i) {
                        dp[in[i][j]] += (dp[i]+1)*1.0/(out[in[i][j]].size()-1);
                    }
                } else {
                    dp[in[i][j]] += (dp[i]+1)*1.0/out[in[i][j]].size();
                }
            }
        }
        minE = min(minE, dp[0]);
    }

    
    cout << setprecision(9) << minE << endl;

}


Measured memory_bytes: 3968