#pragma warning(disable:4996)
#include
#include
#include
#include
#include
#include
#include
using namespace std;
const int INF = 0x3f3f3f3f;
const int MAXN = 100010;
double dp[MAXN];
int Hash[MAXN];
int main()
{
int N, M;
while (cin >> N >> M,N||M)
{
memset(dp, 0, sizeof(dp));
memset(Hash, -1, sizeof(Hash));
dp[N] = 0;
for (int i = M; i >= 1; i--)
{
int a, b;
cin >> a >> b;
Hash[a] = b;
}
for (int i = N - 1; i >= 0; i--)
{
if (Hash[i] == -1)
{
for (int k = 1; k <= 6; k++)
{
dp[i] += dp[i+k] * (1.0 / 6.0);
}
dp[i] += 1;
}
else
{
dp[i] = dp[Hash[i]];
}
}
printf("%.4f\n", dp[0]);
}
return 0;
}