#include <iostream>
#include<cmath>
using namespace std;

class UFO{
public:
    int x0,y0,r,v;
    int IsDestroyed;
    UFO(){
        x0=0;
        y0=0;
        r=0;
        v=0;
        IsDestroyed = 0;
    }
    double get_distance(int t){
        return sqrt(1.0*x0*x0+1.0*y0*y0)-1.0*v*t;//???????????§????????¢
    }
};

int main(){
    int Radius,NumUFO;
    while(cin >> Radius >> NumUFO && (Radius|NumUFO)){
        int invasion=0;
        int i;
        UFO *u;
        u = new UFO[NumUFO];
        for(i=0;i<NumUFO;i++){
            cin >> u[i].x0 >> u[i].y0 >> u[i].r >> u[i].v;
        }
        int alive = NumUFO;
        int t=0;//??????
        for(i=0;i<NumUFO;i++){
            if(1.0*Radius > u[i].get_distance(t)){
                u[i].IsDestroyed = 1;
                alive--;
                invasion++;
            }
        }
        while(alive){//???????????£?????????UFO?????°???0??????????????§
            //?????????????\´???????????????
            int nearest;
            double vnearest = 100000.0;
            for(i=0;i<NumUFO;i++){
                if(u[i].IsDestroyed==0){
                    if(vnearest > u[i].get_distance(t)){
                        nearest = i;
                        vnearest = u[i].get_distance(t);
                    }
                }
            }
            //?????????????\´???????????£?????¬?????¶??????????°?
            //?????¨??´???????????¢?????¬?????¨??????
            int a = u[nearest].x0;
            int b = u[nearest].y0;
            for(i=0;i<NumUFO;i++){
                if(u[i].IsDestroyed==0){
                    //??????t????????????UFO???????????´????????????
                    double x,y;
                    x = 1.0*u[i].x0 - 1.0*u[i].x0*u[i].v*t/(sqrt(1.0*u[i].x0*u[i].x0+1.0*u[i].y0*u[i].y0));
                    y = 1.0*u[i].y0 - 1.0*u[i].y0*u[i].v*t/(sqrt(1.0*u[i].x0*u[i].x0+1.0*u[i].y0*u[i].y0));
                    if( (b*x-a*y)*(b*x-a*y) < 1.0*u[i].r*u[i].r*(a*a+b*b) && a*x + b*y > 0){
                        u[i].IsDestroyed = 1;
                        alive--;
                    }
                }
            }
            t++;//?¬?????????????
            for(i=0;i<NumUFO;i++){
                if(u[i].IsDestroyed==0){
                    if(1.0*Radius > u[i].get_distance(t)){
                        u[i].IsDestroyed = 1;
                        alive--;
                        invasion++;
                    }
                }
            }
        }
        cout << invasion << endl;
    }
    
    return 0;
}