#include <cstdio>
#include <cstring>
#include <iostream>
#include <cmath>
#include <algorithm>
#include <queue>
#include <vector>
using namespace std;
const int maxe = ;
const int maxn = ;
const int INF = 0x3f3f3f;
double dp[maxn];
int map[maxn];
int main()
{
//freopen("E:\\acm\\input.txt","r",stdin);
int N,M;
while(cin>>N>>M && N+M){
for(int i=N;i<=N+;i++) dp[i] = ;
memset(map,,sizeof(map));
for(int i=;i<=M;i++){
int x,y;
scanf("%d %d",&x,&y);
map[x] = y;
}
for(int i=N-;i>=;i--){
if(map[i]){
dp[i] = dp[map[i]];
continue;
}
int a[];
double sum = ;
for(int j=;j<=;j++){
a[j] = i+j;
while(map[a[j]]){
a[j] = map[a[j]];
}
sum += dp[a[j]] + ;
}
dp[i] = sum/;
}
printf("%.4lf\n",dp[]);
}
}