#include <bits/stdc++.h>
#define FAST ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
typedef long long ll;
typedef long double ld;
#define pb push_back
#define mp make_pair

using namespace std;

/*void dfs(ll curr, vector<ll> v[], bool vis[], vector<ll> &fin)
{
    vis[curr] = 1;
    for(auto it = v[curr].begin();it!=v[curr].end();it++)
    {
        if(vis[*it])
            continue;
        dfs(*it,v,vis);    
    }
    
    fin.pb(curr);
}

void ts(vector<ll> v[], ll st, ll n, vector<ll> &fin)
{
    bool vis[n];
    memset(vis,0,sizeof(vis));
    
    dfs(st,v,vis,fin);
    for(ll i=0;i<n;i++)
    {
        if(vis[i])
            continue;
        dfs(i,v,vis,fin);    
    }
}*/

int main()
{
   FAST/**/
   
   ll n,m;
   cin>>n>>m;
   
   vector<ll> v[n];
   pair<ll,ll> ed[m];
   for(ll i=0;i<m;i++)
   {
       ll a,b;
       cin>>a>>b;
       
       a--, b--;
       v[a].pb(b);
       ed[i] = mp(a,b);
   }
   ll mark[n];
   memset(mark,0,sizeof(mark));
   mark[n-1] = 1;
   for(ll i=n-2;i>-1;i--)
   {
       for(auto it = v[i].begin();it!=v[i].end();it++)
            mark[i]|=mark[*it];
   }
   
  // vector<ll> ts1;
   //ts(v,0,n,ts1);
   ld xl[n],xr[n];
   memset(xl,0,sizeof(xl));
   memset(xr,0,sizeof(xr));
   ld dp[n];
   memset(dp,0,sizeof(dp));
   dp[n-1] = 1;
   for(ll i=n-2;i>-1;i--)
   {
       if(v[i].size() == 0)
            continue;
       ld mul = 1/((ld)v[i].size());
       for(auto it = v[i].begin();it!=v[i].end();it++)
           dp[i]+=mul*(dp[*it]);
   }
   
   ld dp1[n];
   memset(dp1,0,sizeof(dp1));
   dp1[0] = 1;
   for(ll i=0;i<n;i++)
   {
       if(v[i].size() == 0)
            continue;
       ld mul = 1/((ld)v[i].size());
       for(auto it = v[i].begin();it!=v[i].end();it++)
           dp1[*it]+=mul*(dp1[i]);
   }
   
   xl[0] = 0;
   for(ll i=0;i<n;i++)
   {
       if(v[i].size() == 0)
            continue;
       ld mul = 1/((ld)v[i].size());
       for(auto it = v[i].begin();it!=v[i].end();it++)
           xl[*it]+=mul*xl[i] + mul*(dp1[i]);
   }
   
   xr[n-1] = 0;
   for(ll i=n-2;i>-1;i--)
   {
       if(v[i].size() == 0)
            continue;
       ld mul = 1/((ld)v[i].size());
       for(auto it = v[i].begin();it!=v[i].end();it++)
           xr[i]+=mul*xr[*it] + mul*(dp[*it]);
   }
   
   /*for(ll i=0;i<n;i++)
        cout<<dp1[i]<<" ";
   cout<<"\n";
   for(ll i=0;i<n;i++)
        cout<<dp[i]<<" ";
   cout<<"\n";     
   for(ll i=0;i<n;i++)
        cout<<xl[i]<<" ";
   cout<<"\n";     
   for(ll i=0;i<n;i++)
        cout<<xr[i]<<" ";
   cout<<"\n";     
   cout<<"\n";*/
   ld ans = xr[0];
   //cout<<"ans = "<<ans<<"\n";
   for(ll i=0;i<n-1;i++)
   {
       if(v[i].size() == 0)
            continue;
       if(mark[i] == 0)
            continue;
       if(v[i].size() == 1)
           continue;        
       
       ld mul = 1/(ld(v[i].size()));
       ld muli = mul;
       mul=1/(ld(v[i].size() - 1));
       ld prev = 0;
       for(auto it = v[i].begin();it!=v[i].end();it++)
       {
           prev+=(muli-mul)*(xl[i]*dp[*it] + xr[*it]*dp1[i]);
       }
       //cout<<"at "<<i+1<<" prev = "<<prev<<"\n";
       ld ans1 = xr[0]-prev;
       
       
       //mul = 1/(ld(v[i].size() - 1));
      // ans1+= mul*(xl[i]*dp[i] + xr[*it]*dp1[i]);
       
       ll cnt = 0;
       for(auto it = v[i].begin();it!=v[i].end();it++)
            cnt+=mark[*it];
       //cout<<"at "<<i+1<<" ans1 = "<<ans1<<"\n";        
       
       for(auto it = v[i].begin();it!=v[i].end();it++)
       {
           if(cnt == 1 && mark[*it])
                continue;        
           //cout<<"at "<<i+1<<" "<<*it+1<<"\n";        
           ld temp1 = ans1 -  (mul*(xl[i]*dp[*it] + xr[*it]*dp1[i]));
           ans = min(ans, temp1);
       }
   }
   
   cout<<fixed<<setprecision(15)<<ans;
   
   
   
   return 0;
}

Measured memory_bytes: 5376