import core.bitop, std.bitmanip;
import core.checkedint;
import std.algorithm, std.functional;
import std.array, std.container;
import std.bigint;
import std.conv;
import std.math, std.numeric;
import std.range, std.range.interfaces;
import std.stdio, std.string;
import std.typecons;

void main()
{
    int n, m;
    readf("%s %s", &n, &m);
    readln;

    auto g = new int[][] (n+1);
    
    foreach (_; 0 .. m) {
        int u, v;
        readf("%s %s", &u, &v);
        readln;
        
        g[u] ~= v;
    }
    
    immutable int INF = 10 ^^ 9 + 23;
    
    auto vis = new bool[] (n+1);
    vis[] = false;
    auto ans = new double[] (n+1);
    ans[] = INF;
    auto nocut = new double[] (n+1);
    nocut[] = INF;
    
    void dfs(int v) {
        vis[v] = true;
        if (v == n) {
            ans[v] = 0;
            nocut[v] = 0;
            return;
        }
        
        debug { writeln(v, ' ', g[v]); }
        
        double mx = 0;
        double sm = 0;
        foreach (u; g[v]) {
            if (!vis[u]) { dfs(u); }
            sm += nocut[u];
            mx = max(mx, nocut[u]);
        }
        
        nocut[v] = 1 + sm / g[v].length;
        
        if (g[v].length == 1) {
            ans[v] = ans[g[v].front] + 1;
        } else {
            ans[v] = 1 + (sm - mx) / (g[v].length - 1);
            
            foreach (u; g[v]) {
                auto restavg = (sm - nocut[u]) / (g[v].length - 1);
                auto curbest = ans[u];
                ans[v] = min(ans[v], 1 + (restavg * (g[v].length - 1) / g[v].length + curbest * 1 / g[v].length));
            }
        }
    }
    
    dfs(1);
    
    debug { ans.writeln; nocut.writeln; }
    
    writefln("%.10f", ans[1]);
}