#include<iostream>
#include<cstring>
#include<cstdio>
using namespace std;
const int maxn=100010;
int f[maxn];
double e[maxn],p[maxn];
int find(int x)
{
    return f[x]==x?x:f[x]=find(f[x]);
}
int main()
{
    int n,m;
    while(scanf("%d%d",&n,&m),n+m)
    {
        for(int i=0;i<=n;i++)
        f[i]=i;
        for(int i=1;i<=m;i++)
        {
            int x,y;
            scanf("%d%d",&x,&y);
            f[find(x)]=y;
        }
        memset(e,0,sizeof(e));
        memset(p,0,sizeof(p));
        p[0]=1;

        for(int i=0;i<n;i++)
         for(int j=1;j<=6;j++)
         {
            int temp=find(i+j);
            e[temp]+=(e[i]+p[i])/6.0;
            p[temp]+=p[i]/6.0;
         }
        double ans=0;
        for(int i=0;i<=5;i++)
            ans+=e[n+i];
        printf("%.4f\n",ans);
    }
    return 0;
}