### BUGGY CODE ###

import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**9)
from collections import deque

def main():
    n, m = map(int, input().split())
    g = [[] for i in range(n)]
    deg = [0]*n
    deg2 = [0]*n
    atode = []
    for i in range(m):
        s, t = map(int, input().split())
        g[s-1].append(t-1)
        deg[t-1] += 1
        deg2[s-1] += 1
        atode.append((s-1,t-1))

    ans = list(v for v in range(n) if deg[v]==0)
    deq = deque(ans)
    used = [0]*n

    while deq:
        v = deq.popleft()
        for t in g[v]:
            deg[t] -= 1
            if deg[t]==0:
                deq.append(t)
                ans.append(t)
    # ansがトポロジカル順番

    # convert
    c = {j:i for i,j in enumerate(ans)}

    # まず、O(N)で期待値を求める
    e = [-1]*n
    #print(g)
    def rec(cur):
        if e[cur] != -1:
            return e[cur]
        res = 0
        cnt = 0
        for to in g[cur]:
            res += rec(to)+1
            cnt += 1
        # 0のとき→end
        if cnt:
            res /= cnt
        e[cur] = res
        return e[cur]

    rec(0)
    #print(e)

    # すべての辺について、やる
    # 辺が使える条件→fromの辺の次数が必ず2以上
    # このとき、fromよりもトポロジカル順番で後ろにあるものについては計算しなくていい

    # s,tの辺を消したときの期待値
    ee = [-1]*n
    def rec2(cur, s,t):
        # 計算を飛ばせる時
        if c[cur] > c[s]:
            return e[cur]
        # 計算済みのとき
        if ee[cur] != -1:
            return ee[cur]
        # 計算する
        res = 0
        cnt = 0
        for to in g[cur]:
            if cur==s and to ==t:
                continue
            res += rec2(to,s,t)+1
            cnt += 1
        if cnt:
            res /= cnt
        ee[cur] = res
        return ee[cur]

    # 何もしなかった時が最小値の候補の内最大
    ret = e[0]

    # 辺を消す候補はN個
    use = [[-1, -1] for i in range(n)]
    for s,t in atode:
        if deg2[s] < 2:
            continue
        if use[s][1] < e[t]:
            use[s][0] = t
            use[s][1] = e[t]

    for s, (t,cost) in enumerate(use):
        if s == -1:
            continue
        ee = [-1]*n
        rec2(0,s,t)
        ret = min(ret, ee[0])
    print(ret)

if __name__ == "__main__":
    main()

### FIXED CODE ###

import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**9)

def main():
    n, m = map(int, input().split())
    g = [[] for i in range(n)]
    deg2 = [0]*n
    atode = []
    for i in range(m):
        s, t = map(int, input().split())
        g[s-1].append(t-1)
        deg2[s-1] += 1
        atode.append((s-1,t-1))

    ee = [-1]*n
    def rec2(cur, s,t):
        if ee[cur] != -1:
            return ee[cur]
        res = 0
        cnt = 0
        for to in g[cur]:
            if cur==s and to ==t:
                continue
            res += rec2(to,s,t)+1
            cnt += 1
        if cnt:
            res /= cnt
        ee[cur] = res
        return ee[cur]

    rec2(0,-1,-1)
    ret = ee[0]

    use = [[-1, -1] for i in range(n)]
    for s,t in atode:
        if deg2[s] < 2:
            continue
        if use[s][1] < ee[t]:
            use[s][0] = t
            use[s][1] = ee[t]

    for s, (t,cost) in enumerate(use):
        if s == -1:
            continue
        ee = [-1]*n
        rec2(0,s,t)
        ret = min(ret, ee[0])
    print(ret)

if __name__ == "__main__":
    main()