#include <stdio.h>
#include <math.h>
#define mmin(x,y) (x)<(y)?(x):(y)
int main(){
double dp[+];
int c[+];
double w[+];
int n,m,i,j;
int v;
double aim,res;
while(~scanf("%d%d",&n,&m)){
if(n==&&m==) break;
for(i=;i<=n;++i) dp[i]=1.0;
aim=;
for(i=;i<=m;++i){
scanf("%d%lf",&c[i],&w[i]);
w[i]=-w[i];
aim*=w[i];
}
for(i=;i<=m;++i){
for(v=n;v>=c[i];--v){
dp[v]=mmin(dp[v],dp[v-c[i]]*w[i]);
}
}
res=;
for(i=n;i>=;--i){
if(dp[i]>=aim){
if(dp[i]<res)
res=dp[i];
}
}
printf("%.1lf%%\n",(-res)*);
}
return ;
}