#include<iostream>
#include<vector>
#include<math.h>
using namespace std;

struct ufo{
    double x;
    double y;
    double r;
    double v;
    int state;
};

double dist(struct ufo u){
    return sqrt(u.x*u.x+u.y+u.y);
}

bool killable(vector<struct ufo> &u,int n,double r){
    for(int i=0;i<n;i++){
        if(u[i].state==1)continue;
        if(dist(u[i])>r){
            return true;
        }
    }
    return false;
}

int nearest(vector<struct ufo> &u,int n,double r){
    double mindist=INFINITY;
    int idx=0;
    for(int i=0;i<n;i++){
        if(u[i].state==1)continue;
        if(dist(u[i])<=r)continue;
        if(dist(u[i])<mindist){
            mindist=dist(u[i]);
            idx=i;
        }
    }
    return idx;
}

void kill(vector<struct ufo> &u,int n,double r,int nearest){
    double a=u[nearest].y/dist(u[nearest]);
    double b=u[nearest].x/dist(u[nearest]);
    double dst=sqrt(a*a+b*b);
    for(int i=0;i<n;i++){
        if(dist(u[i])+u[i].r<=r)continue;
        if((b*u[i].x>=0||a*u[i].y>=0)&&fabs(u[i].x*a-u[i].y*b)/dst<u[i].r) u[i].state=1;
    }
}

int main(void){
    double r,n;
    int near,count=0;
    cin>>r>>n;
    vector<struct ufo> u;
    while(r*n!=0){
        u.resize(n);
        for(int i=0;i<n;i++){
            cin>>u[i].x>>u[i].y>>u[i].r>>u[i].v;
            u[i].state=0;
        }
        while(killable(u,n,r)){
            for(int i=0;i<n;i++){
                u[i].x-=u[i].v*u[i].x/dist(u[i]);
                u[i].y-=u[i].v*u[i].y/dist(u[i]);
            }
            if(!killable(u,n,r))break;
            near=nearest(u,n,r);
            kill(u,n,r,near);
        }
        
        for(int i=0;i<n;i++){
            if(u[i].state==0)count++;
        }
        cout<<count<<endl;
        u.clear();
        count=0;
        cin>>r>>n;
    }
    return 0;
}
