//例题7.2 Fatmouse'Trade
struct room{
    int number;
    int money;
    float price;
};

int compare(room x,room y){
    return x.price<y.price;
}

int main(){
    int m,n,number,money,i;
    float sum=0;
    while(1){
        sum=0;
        scanf("%d%d",&m,&n);
        if(m==-1)break;
        room r[n];
        for(i=0;i<n;i++){
            scanf("%d%d",&number,&money);
            r[i].number=number;
            r[i].money=money;
            r[i].price=float(money)/number;
        }
        sort(r,r+n,compare);
        i=0;
        while(m>r[i].money){
            sum+=r[i].number;
            m-=r[i].money;
            i++;
        }
        if(m>0){
            sum+=m/r[i].price;
        }
        printf("%.3f\n",sum);
    }
    return 0;
}