#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <deque>
#include <fstream>
#include <functional>
#include <iostream>
#include <istream>
#include <iterator>
#include <sstream>
#include <list>
#include <map>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <iomanip>
using namespace std;

#define BR "\n"
#define REP(i, n) for(int (i)=0;(i)<(n);++(i))
#define ALL(cont) begin(cont),end(cont)
#define AS_MOD(a, b) ((((a) % (b) ) + (b)) % (b))
#define FEACH(it, cont) for(auto (it) = begin(cont); it!=end(cont);++it)
#define FEACHR(it, cont) for(auto (it) = rbegin(cont); it!=rend(cont);++it)
#define pb push_back
#define pob pop_back
#define fi first
#define se second
#define getll() ([](){ll s;scanf("%lld", &s);return s;})()
#define getld() ([](){ld s;scanf("%Lf", &s);return s;})()
#define prl(P) printf("%lld", P)
#define prd(P) printf("%.10Lf", P)
#define pr(P) printf(P)
#define MAX(V, T) V=max(V,T)
#define MIN(V, T) V=min(V,T)

#define DumpArray(cont, from, to) for(int __i=from;__i<to;++__i) {cout<<"(" <<__i<<": " << cont[__i]<<")";} cout<<endl;

/*
 * ***_bound(6)
 * 5 6 6 6 6 6 7 7 7
 *   ^lower    ^upper
 * void reverse(c.begin(), c.end())
 *
 * graph
 * seg tree
 * dp
 * brute force
 */
struct Comparator{
    int operator()(int l, int r) const {
        return r<l;
    }
};
//set<int, Comparator> S;

struct Vec{
    double v[2];
    string to_s(){
        return "("+to_string(v[0])+","+to_string(v[1])+")";
    }
    double& operator[](int t){
        return v[t];
    }
    Vec operator+(Vec t) {
        return {v[0]+t[0],v[1]+t[1]};
    }
    Vec& operator+=(Vec t) {
        v[0]+=t[0];v[1]+=t[1];
        return *this;
    }
    Vec operator-(Vec t) {
        return {v[0]-t[0],v[1]-t[1]};
    }
    Vec& operator-=(Vec t) {
        v[0]-=t[0];v[1]-=t[1];
        return *this;
    }
    Vec operator*(double t) {
        return {v[0]*t,v[1]*t};
    }
    Vec& operator*=(double t) {
        v[0]*=t;v[1]*=t;
        return *this;
    }
    double operator*(Vec t) {
        return v[0]*t[0]+v[1]*t[1];
    }
    Vec operator-(){
        return {-v[0],-v[1]};
    }
    static Vec Z;
};
Vec Vec::Z={0,0};

typedef long long ll;
typedef long double ld;
typedef pair<int,int> Edge;
ll N,M;
vector<ld> P;
vector<ld> E;
vector<bool> Visited;
vector<vector<int>> G;
vector<vector<int>> revG;
vector<Edge> Edges;
void dfsP(int c) {
    ld s=0;
    for(int n:revG[c]) {
        if (!Visited[n]) {
            dfsP(n);
        }
        s+=P[n]/G[n].size();
    }
    P[c]=s;
    Visited[c]=true;
}
void dfsE(int c) {
    ld s=0;
    for(int n:G[c]) {
        if (!Visited[n]) {
            dfsE(n);
        }
        s+=(E[n]+1)/G[c].size();
    }
    E[c]=s;
    Visited[c]=true;
}
int main() {
    cout.precision(10);
    cout<<fixed;
    cin >> N >> M;
    Visited.resize(N,false);
    P.resize(N,0);
    E.resize(N,0);
    G.resize(N);
    revG.resize(N);
    REP(i,M) {
        int s,t;
        cin >> s >> t;--s;--t;
        G[s].pb(t);
        revG[t].pb(s);
        Edges.pb({s,t});
    }
    P[0]=1;
    Visited[0]=true;
    dfsP(N-1);
    fill(ALL(Visited),false);
    Visited[N-1]=true;
    E[N-1]=0;
    dfsE(0);
    ld ansE=E[0];
    for(Edge e:Edges) {
        if (G[e.fi].size()==1)continue;
        ld n=G[e.fi].size();
        ld nE=E[0]-P[e.fi]*(1+E[e.se])/n+P[e.fi]*(E[e.fi]*n-(1+E[e.se]))/n/(n-1);
        ansE=min(nE,ansE);
    }
    cout<<ansE<<endl;


    return 0;
}


Measured memory_bytes: 3956