#include <iostream>
#include <vector>
#include <algorithm>
#include <complex>
#include <cmath>

using namespace std;

typedef complex<double> P;
const double PI = acos(-1);
const double EPS = 1e-11;

int cmp(double a, double b) {
    const double d = a-b;
    if(abs(d) < EPS) return 0;
    else if(d < 0) return -1;
    return 1;
}

inline double dot(const P& a, const P& b) { return a.real()*b.real() + a.imag()*b.imag(); }

struct line/*{{{*/
{
  P a, b;
  line() {}
  line(const P& p, const P& q) : a(p), b(q) {}

  // AOJ 1171 Laser Beam Reflections
  inline P perpendicular(const P& p) const
  {
    // 点 p から直線上に下ろした垂線の足
    const double t = dot(p-a, a-b) / dot(b-a, b-a);
    return a + t*(a-b);
  }

  inline double distance(const P& p) const {
      return abs(p - this->perpendicular(p));
  }
};/*}}}*/

struct UFO {
    P pos, dv;
    double r;

    UFO() {}
    UFO(const P &p, double r, double v) : pos(p), r(r) {
        dv = pos * v / abs(pos);
    }

    void move() {
        if(cmp(abs(dv), abs(pos)) >= 0) {
            pos = P(0, 0);
        } else {
            pos -= dv;
        }
    }
};

bool solve() {
    int R, N;
    cin >> R >> N;
    if(!R && !N) return false;

    vector<UFO> ufos;
    for(int i = 0; i < N; ++i) {
        double x, y, r, v;
        cin >> x >> y >> r >> v;
        ufos.push_back(UFO(P(x, y), r, v));
    }
    int ans = 0;
    while(true) {
        const int M = ufos.size();
        double min_dist = 1e10;
        int min_idx = -1;
        for(int i = 0; i < M; ++i) {
            UFO &u = ufos[i];
            u.move();
            const double d = abs(u.pos);
            if(cmp(d, R) > 0 && d < min_dist) {
                min_dist = d;
                min_idx = i;
            }
        }
        if(min_idx == -1) break;
        //cout << ufos[min_idx].pos << endl;
        const line l(P(0, 0), ufos[min_idx].pos);
        auto pend = remove_if(ufos.begin(), ufos.end(), [&](const UFO &u) {
                return dot(ufos[min_idx].pos, u.pos) >= 0 && cmp(abs(u.pos), R) > 0 && cmp(l.distance(u.pos), u.r) <= 0;
                });
        //cout << distance(pend, ufos.end()) << endl;
        ufos.erase(pend, ufos.end());
    }
    cout << ufos.size() << endl;
    return true;
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(0);

    while(solve()) ;
    return 0;
}