#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<cmath>
#include<vector>
using namespace std;

const int N=607,INF=1e9;
int n,m,a[N*N],b[N*N];
vector <int> V[N];
double  f[N],ans;
double calc(int p)
{
    for(int i=1;i<=n;i++) f[i]=0;
    f[n]=0;
    for(int i=n-1;i>=1;i--)
    {
        int len=V[i].size();
        if(p==i&&len==1) { f[i]=INF; continue; }
        double t=1.0/(len-(p==i)),mx=0;
        for(int j=0;j<len;j++)
        {
            int v=V[i][j]; mx=max(mx,(f[v]+1)*t);
            f[i]+=(f[v]+1)*t;
        }
        if(p==i) f[i]-=mx;
    }
    return f[1];
}
int main()
{
    scanf("%d%d",&n,&m);

    for(int i=1;i<=m;i++)
    {
        scanf("%d%d",&a[i],&b[i]);
        V[a[i]].push_back(b[i]);
    }
    ans=calc(0);
    for(int i=1;i<=n;i++)
        ans=min(ans,calc(i));
    printf("%.9lf\n",ans);
    return 0;
}


