#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <iomanip>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <bitset>
#include <stack>
#include <utility>
#include <numeric>
#include <algorithm>
#include <functional>
#include <cctype>
#include <complex>
#include <string>
#include <cstring>
#include <sstream>

using namespace std;

#define all(c) c.begin(),c.end()
#define rep(i,n) for(int i=0;i<(int)n;i++)

typedef long long ll;
typedef complex<double> point;
typedef pair<int,int> pii;

// →↑←↓
const int dx[] = {1,0,-1,0};
const int dy[] = {0,-1,0,1};

const double EPS = 1e-9;

struct ufo{
    point c;
    double r,v;
    bool alive;
};

//when goal return true;
bool go(ufo &u,int R){
    if(not u.alive) return false;
    if(abs(u.c) < R + u.v + EPS){
        u.c = 0;
        u.alive = false;
        return true;
    }else{
        u.c -= u.v * (u.c / (abs(u.c)));
        return false;
    }
}

double cross(point a,point b){
    return imag(conj(a)*b);
}

double dot(point a,point b){
    return real(conj(a)*b);
}
// 直線と点との距離
double dist_line_and_point(point a1,point a2,point b){
    return abs(cross(a2-a1,b-a1)) / abs(a2-a1);
}

// 線分と点との距離
double dist_linesegment_and_point(point a1,point a2,point b){
    if(dot(a2-a1,b-a1) < EPS) return abs(b-a1);
    if(dot(a1-a2,b-a2) < EPS) return abs(b-a2);
    return dist_line_and_point(a1,a2,b);
}

// 円と線分の交差判定
bool is_cross_linesegment_and_circle(point c,double r,point a1,point a2){
    return (dist_linesegment_and_point(a1,a2,c) < r+EPS and
             (r < abs(c-a1) + EPS or r < abs(c-a2) + EPS));
}

int main(){
    while(true){
        double R;
        int N;
        cin >> R >> N;
        if(abs(R) < EPS and N == 0) break;
        vector<ufo> us(N);

        for(int i=0;i<N;i++){
            cin >> us[i].c.real() >> us[i].c.imag() >> us[i].r >> us[i].v;
            us[i].alive = true;
        }

        int cnt = 0;
        while(true){
            int ac = 0;
            for(int i=0;i<N;i++){
                if(go(us[i],R)){
                    cnt++;
                }
                if(us[i].alive) ac++;
            }
            if(ac == 0) break;

            int nearest = 0;
            double mindist = 1e10;
            for(int i=0;i<N;i++){
                if(not us[i].alive) continue;
                if(mindist + EPS > abs(us[i].c)){
                    mindist = abs(us[i].c);
                    nearest = i;
                }
            }
            for(int i=0;i<N;i++){
                if(not us[i].alive) continue;
                if(is_cross_linesegment_and_circle(us[i].c,us[i].r,
                   us[nearest].c*point(1e10,0),us[nearest].c/abs(us[nearest].c)*R)){
                    us[i].alive = false;
                }
            }
        }
        cout << cnt << endl;

    }
    return 0;
}