### BUGGY CODE ###

#!usr/bin/env python3
from collections import defaultdict,deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS():return [list(x) for x in sys.stdin.readline().split()]
def S():
    res = list(sys.stdin.readline())
    if res[-1] == "\n":
        return res[:-1]
    return res
def IR(n):
    return [I() for i in range(n)]
def LIR(n):
    return [LI() for i in range(n)]
def SR(n):
    return [S() for i in range(n)]
def LSR(n):
    return [LS() for i in range(n)]

sys.setrecursionlimit(1000000)
mod = 1000000007

def solve():
    n,m = LI()
    v = [[] for i in range(n)]
    for i in range(m):
        a,b = LI()
        a -= 1
        b -= 1
        v[a].append(b)
    dp = [[0]*2 for i in range(n)]
    dp[0] = [0,1]
    for x in range(n-1):
        s = sum(dp[x])/len(v[x])
        s_ = dp[x][1]/len(v[x])
        for y in v[x]:
            dp[y][0] += s
            dp[y][1] += s_
    ans = dp[-1][0]
    a = 0
    while len(v[a]) == 1:
        a = v[a][0]
    for a in range(n-1):
        for b in v[a]:
            dp = [[0]*2 for i in range(n)]
            dp[0] = [0,1]
            for x in range(n-1):
                l = len(v[x])
                if a == x:
                    l -= 1
                if l == 0:
                    if dp[x][0] > 0:
                        y = v[x][0]
                        dp[y][0] = float("inf")
                    continue
                s = sum(dp[x])/l
                s_ = dp[x][1]/l
                for y in v[x]:
                    if (a,b) == (x,y):
                        continue
                    dp[y][0] += s
                    dp[y][1] += s_
                else:
                    continue
                break
            if 0 < dp[-1][0] < ans:
                ans = dp[-1][0]
    print(ans)
    return

#Solve
if __name__ == "__main__":
    solve()


### FIXED CODE ###

#!usr/bin/env python3
from collections import defaultdict,deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS():return [list(x) for x in sys.stdin.readline().split()]
def S():
    res = list(sys.stdin.readline())
    if res[-1] == "\n":
        return res[:-1]
    return res
def IR(n):
    return [I() for i in range(n)]
def LIR(n):
    return [LI() for i in range(n)]
def SR(n):
    return [S() for i in range(n)]
def LSR(n):
    return [LS() for i in range(n)]

sys.setrecursionlimit(1000000)
mod = 1000000007

def solve():
    n,m = LI()
    v = [[] for i in range(n)]
    v_ = [[] for i in range(n)]
    for i in range(m):
        a,b = LI()
        a -= 1
        b -= 1
        v[a].append(b)
        v_[b].append(a)
    dp_ = [0]*n
    for y in range(1,n)[::-1]:
        v_[y].sort()
        d = dp_[y]
        for x in v_[y]:
            dp_[x] += (d+1)/len(v[x])
    ans = dp_[0]
    lx = []
    for a in range(n-1):
        lx.append(len(v[a])-1)
        if len(v[a]) == 1:
            lx[-1] += 1
            continue
        m = max([dp_[b] for b in v[a]])
        for b in v[a]:
            if dp_[b] == m:
                break
        for i in range(a+1):
            dp_[i] = 0
        for y in range(1,n)[::-1]:
            d = dp_[y]
            for x in v_[y]:
                if x > a:
                    break
                if (x,y) == (a,b):
                    continue
                dp_[x] += (d+1)/lx[x]
        if 0 < dp_[0] < ans:
            ans = dp_[0]
        lx[-1] += 1
    print(ans)
    return

#Solve
if __name__ == "__main__":
    solve()