/***********************************************************
 *This code By @1353055672(Ligen)                          *
 *[Warning]You're not excepted to understand this code!    *
 *CSP-S 2019 RP++                                          *
 ***********************************************************/
// #pragma GCC optimize(3)
#define ADD_STACK int size = 512 << 20;\
	char *pp = (char*)malloc(size) + size;  \
	__asm__("movl %0, %%esp\n" :: "r"(pp))
#include<iostream>
#include<stdio.h>
#include<algorithm>
#include<cmath>
#include<cstring>
#include<string>
#include<fstream>
#include<queue>
#include<map>
#include<stack>
#include<set>
#include<bitset>
#include<ctime>
#include<vector>
#define ll long long
#define ull unsigned long long
#define mn 500020
#define Max(x,y) (((x)>(y))?(x):(y))
#define Min(x,y) (((x)<(y))?(x):(y))
#define Abs(x) (((x)<(0))?(-(x)):(x))
#define infll (ll)(1e18)
#define infint (1<<30)
#define mod (int)(1e9+7)
#define FOR(a,b,c) for (register int a=b;a<=c;++a)
#define FORD(a,b,c) for (register int a=b;a>=c;--a)
using namespace std;
// char buf[1<<20],*p1=buf,*p2=buf;
// #define getchar() (p1==p2&&(p2=(p1=buf)+fread(buf,1,1<<20,stdin),p1==p2)?EOF:*p1++)
inline ll read() {
	ll x = 0, f = 1; char c;
	for (c = getchar(); c < '0' || c > '9'; f = ((c == '-') ? -1 : f), c = getchar());
	for (; c >= '0' && c <= '9'; x = x * 10 + c - '0', c = getchar());
	return x * f;
}
template<typename T>
inline void write(T a) {
	if (a == 0) {
		putchar('0');
		return;
	} if (a < 0)putchar('-'), a = -a; char c1[120]; int h = 0;
	while (a)c1[++h] = a % 10 + '0', a /= 10; FORD(i, h, 1)putchar(c1[i]);
}
inline void write_() {
	return;
}
template<typename T, typename... Args>
inline void write_(T a, Args... b) {
	write(a);
	putchar(' ');
	write_(b...);
}
inline void writeln() {
	putchar('\n');
	return;
}
template<typename T, typename... Args>
inline void writeln(T a, Args... b) {
	write(a);
	putchar(' ');
	writeln(b...);
}
//need c++11

//inline void write(ll a){
//    if(a==0){putchar('0');return;}if(a<0)putchar('-'),a=-a;char c1[120];int h=0;
//    while(a)c1[++h]=a%10+'0',a/=10;FORD(i,h,1)putchar(c1[i]);
//}
//inline void write_(ll a){write(a);putchar(' ');}
//inline void writeln(ll a){write(a);putchar('\n');}
inline ll gcd(ll a, ll b) {
	return a == 0 ? b : gcd(b % a, a);
}
inline ll lcm(ll a, ll b) {
	return 1ll * a / gcd(a, b) * b;
}
inline ll Pow(ll n, ll a) {
	ll b = 1;
	while (a) {
		if (a & 1)b = 1ll * b * n % mod;
		n = 1ll * n * n % mod;
		a >>= 1;
	} return b;
}
//---------------------Head Files--------------------------//
int n, m, fir[mn], nxt[mn], y[mn], tot, Out[mn], cnt;
double v[620][620];
struct edge {
	int x, y;
} a[mn];
double f[mn], ans, sum;
inline void adde(int x, int yy) {
	nxt[++tot] = fir[x]; fir[x] = tot; y[tot] = yy; ++Out[x];
}
signed main() {
#ifdef LOCAL_LIGEN
	// freopen("0.in", "r", stdin);
	// freopen("0.out", "w", stdout);
	double be = clock();
#endif
	n = read(), m = read();
	FOR(i, 1, m)a[i].x = read(), a[i].y = read(), adde(a[i].x, a[i].y);
	FOR(i, 1, m)v[a[i].x][0] = 1, v[a[i].x][a[i].y] = 1.0000 / (1.0000 * Out[a[i].x]);
	// writeln(n, m);
	FORD(i, n, 1) {
		f[i] = v[i][0];
		FOR(j, 1, n)f[i] += 1.0000 * v[i][j] * f[j];
		// printf("%d %.10lf\n", i, f[i]);
	}
	ans = f[1];
	FOR(x, 1, n)if (Out[x] > 1) {
		FOR(i, 1, n) {
			FOR(j, 1, n)v[i][j] = 0;
			v[i][0] = 1;
			f[i] = 0;
		}
		v[n][0] = 0;
		FOR(i, 1, m)if (a[i].x != x)v[a[i].x][a[i].y] = 1.0000 / (1.0000 * Out[a[i].x]);
		// FORD(i, x - 2, 1) {
		// 	v[i][0] += 1.0000 * v[i][i + 1] * v[i + 1][0];
		// 	FOR(k, x, n)v[i][k] += 1.0000 * v[i][i + 1] * v[i + 1][k];
		// 	v[i][i + 1] = 0;
		// }
		FORD(i, n - 1, x + 1) {
			f[i] = v[i][0];
			FOR(j, i + 1, n)f[i] += 1.000 * v[i][j] * f[j];
		}
		FORD(i, x - 1, 1) {
			FOR(j, x + 1, n)v[i][0] += 1.0000 * v[i][j] * f[j], v[i][j] = 0;
			FORD(j, x - 1, i + 1) {
				v[i][0] += 1.0000 * v[i][j] * v[j][0];
				v[i][x] += 1.0000 * v[i][j] * v[j][x];
				v[i][j] = 0;
			}
		}
		// writeln(x);
		// FOR(i, 1, n) {
		// 	FOR(j, 0, n)printf("%.5lf ", v[i][j]);
		// 	printf("%.5lf\n", f[i]);
		// }
		for (int i = fir[x]; i; i = nxt[i]) {
			f[x] = 1;
			for (int j = fir[x]; j; j = nxt[j])if (y[i] != y[j])f[x] += (1.00000 / (1.0000 * (Out[x] - 1))) * f[y[j]];
			if (x > 1)f[1] = v[1][0] + 1.0000 * v[1][x] * f[x];
			// write_(x, y[i]); printf("%.10lf\n", f[1]);
			ans = Min(ans, f[1]);
		}
	}
	// Out[n]=1;
// 	FORD(i,n-1,1){
// 		v[i][0]=1;
// 		// Out[i]=0;
// 		// for(int j=fir[i];j;j=nxt[j])Out[i]+=Out[y[j]];
// 		for(int j=fir[i];j;j=nxt[j])v[i][y[j]]=1.0000/(1.000000*Out[i]);
// 	}
// //	FORD(i,n-2,1)FORD(j,n,i+1){FOR(k,0,n)v[i][k]+=1.0000*v[i][j]*v[j][k];v[i][j]=0;}
// //	FOR(i,1,n){FOR(j,0,n)printf("%.10lf ",v[i][j]);puts("");}
// //	f[0]=1;
// 	FORD(i,n,1){
// 		f[i]=v[i][0];
// 		FOR(j,1,n)f[i]+=1.0000*v[i][j]*f[j];
// //		printf("%d %.10lf\n",i,f[i]);
// 	}
// 	ans=f[1];
// 	FOR(i,1,m)if(Out[a[i].x]>Out[a[i].y]){
// 		int x=a[i].x;
// 		double ff=1,sum=1;
// 		for(int j=fir[x];j;j=nxt[j])if(y[j]!=a[i].y)ff+=((Out[y[j]]*1.00000)/(1.0000*(Out[x]-Out[a[i].y])))*f[y[j]];
// 		if(a[i].x==1)sum=ff;else FOR(j,1,n)if(j==x)sum+=ff*v[1][j];else sum+=v[1][j]*f[j];
// 		ans=Min(ans,sum);
// //		write_(i,a[i].x,a[i].y),printf("%.10lf\n",sum);
// 	}
	printf("%.10lf\n", ans);
#ifdef LOCAL_LIGEN
	double en = clock();
	printf("Time: %.0lfms\n", en - be);
	fclose(stdin); fclose(stdout);
#endif
	return 0;
}

Measured memory_bytes: 16640