// vim: shiftwidth=2 expandtab foldmethod=marker

// include {{{
#include <algorithm>
#include <chrono>
#include <cmath>
#include <cstdlib>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
// }}}

// debug(...) {{{
#ifdef LOCAL_DEBUG
#include "./debug.h"
#else
bool debug_enabled = false;
#define debug(...)
#define debugn(...)
#define debug_reset()
#endif

// }}}

// bin {{{
template <class T>
std::string bin(int bits, const T& x) {
  char buf[bits + 1];
  buf[bits] = '\0';
  for (int i = 0; i < bits; i++) {
    if ((x >> i) & 1) {
      buf[bits - i - 1] = '1';
    } else {
      buf[bits - i - 1] = '0';
    }
  }
  return std::string(buf);
}
std::string bin(int x) {
  if (x < 0) return bin(32, x);
  for (int i = 4; i < 31; i++) {
    int y = 1 << i;
    if (x < y) return bin(i, x);
  }
  return bin(32, x);
}
// }}}

// misc {{{
using namespace std;
template <class T, class U>

using umap = unordered_map<T, U>;
template <class T>
using uset = unordered_set<T>;

typedef long long ll;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)

template <class T>
void sort(T& arr) {  // {{{
  std::sort(arr.begin(), arr.end());
}  // }}}
template <class T, class By>
void sort_by(T& arr, By by) {  // {{{
  std::sort(arr.begin(), arr.end(), [by](auto l, auto r) { return by(l) < by(r); });
}  // }}}

template <class T>
void reverse(T& arr) {  // {{{
  std::reverse(arr.begin(), arr.end());
}  // }}}

class Random {  // {{{
 public:
  std::uniform_int_distribution<> uniform_int;
  std::mt19937 rnd;
  std::bernoulli_distribution bern_dist;
  int uniform(int l, int r) {
    return uniform_int(rnd, std::uniform_int_distribution<>::param_type(l, r));
  }
  int next(int N) { return uniform(0, N - 1); }
  int bern(double p) { return bern_dist(rnd, std::bernoulli_distribution::param_type(p)); }
};  // }}}

template <class A>
ostream& out_vec(const vector<A>& x, const string& sep) {  // {{{
  rep(i, x.size()) {
    cout << x[i];
    if (i < x.size() - 1) cout << sep;
  }
  return cout;
}  // }}}
// }}}

// modulo {{{
ll modpow(ll a, ll n, ll mod) {
  ll res = 1;
  while (n > 0) {
    if (n & 1) res = res * a % mod;
    a = a * a % mod;
    n >>= 1;
  }
  return res;
}

ll modplus(ll a, ll b, ll mod) {
  ll x = ((a % mod) + (b % mod)) % mod;
  if (x < 0) x += mod;
  return x;
}

ll modminus(ll a, ll b, ll mod) { return modplus(a, -b, mod); }

// }}}

class UnionFind {  // {{{
  vector<int> parent;

 public:
  UnionFind(int N) : parent(N) { rep(i, N) parent[i] = i; }

  int root(int x) {
    if (parent[x] == x)
      return x;
    else
      return parent[x] = root(parent[x]);
  }

  void unite(int x, int y) {
    int rx = root(x);
    int ry = root(y);
    if (rx != ry) { parent[rx] = ry; }
  }
};  // }}}

// main {{{
void solve();
int main() {
  cout << setprecision(20);
  solve();
}
// }}}

void solve() {
  int N, M;
  cin >> N >> M;
  vector<int> s(M);
  vector<int> t(M);
  rep(i, M) cin >> s[i] >> t[i];

  unordered_map<int, vector<int>> con;
  rep(i, M) con[s[i] - 1].push_back(t[i] - 1);

  function<double(vector<double>&, int, pair<int, int>*)> solve;
  solve = [&](vector<double>& dp, int i, pair<int, int>* exclude) {
    if (dp[i] >= 0) return dp[i];
    if (i == N - 1) return dp[i] = 0.0;
    double sum = 0.0;
    int n = 0;
    for (auto j : con[i]) {
      if (exclude != nullptr && *exclude == make_pair(i, j)) continue;
      sum += 1.0 + solve(dp, j, exclude);
      n++;
    }
    return dp[i] = sum / n;
  };

  vector<double> base_dp(N, -1);

  double ans = solve(base_dp, 0, nullptr);
  rep(i, N - 1) {
    if (con[i].size() < 2) continue;
    int x = -1;
    double p = 0.0;
    for (auto j : con[i]) {
      double q = solve(base_dp, j, nullptr);
      if (p < q) {
        p = q;
        x = j;
      }
    }
    vector<double> dp(N, -1);
    auto ex = make_pair(i, x);
    ans = min(ans, solve(dp, 0, &ex));
  }
  cout << ans << endl;
}


Measured memory_bytes: 2944