#include <bits/stdc++.h>
using namespace std;

#define EPS (1e-6)
#define EQUALS(a, b) (fabs((a) - (b)) < EPS)
#define SQR(n) ((n) * (n))
#define DIST(ax, bx, ay, by) (sqrt(SQR((ax) - (bx)) + SQR((ay) - (by))))

struct UFO
{
    double x, y, r, v;

    UFO () {}
    UFO (double x, double y, double r, double v) : x(x), y(y), r(r), v(v) {}

    void move()
    {
        double dx, dy;
        double rr = dist();

        dx = v * (x / rr), dy = v * (y / rr);
        if ( fabs(x) < fabs(dx) + EPS ) {
            x = EPS, y = EPS;
        } else {
            x -= dx, y -= dy;
        }
    }

    double dist()
    {
        return ( sqrt(SQR(x) + SQR(y)) );
    }

    bool laser(double bx, double by)
    {
        double dot = x * bx + y * by;
        double gx = bx * dot, gy = by * dot;

        return ( DIST(x, gx, y, gy) < r - EPS );
    }

};


int main()
{
    double R;
    int N;

    UFO ufo[105];

    while ( cin >> R >> N, R || N ) {

        for ( int i = 0; i < N; i++ ) {
            double x, y, r, v;
            cin >> x >> y >> r >> v;
            ufo[i] = UFO(x, y, r, v);
        }

        int cnt = 0;
        bool isfinished[105] = {};
        for ( int t = 1; t <= 1000; t++ ) {
            int minp = -1;
            double minv;

            for ( int i = 0; i < N; i++ ) {
                ufo[i].move();
                //cout << ufo[i].x << " " << ufo[i].y << endl;
                double d = ufo[i].dist();
                if ( !isfinished[i] && d > R + EPS && (minp == -1 || minv > d) ) {
                    minv = ufo[i].dist();
                    minp = i;
                }
            }
            //cout << minp << endl;
            if ( minp == -1 ) {
                break;
            } else {
                double x = ufo[minp].x / ufo[minp].dist(), y = ufo[minp].y / ufo[minp].dist();

                isfinished[minp] = true;
                for ( int i = 0; i < N; i++ ) {
                    if ( ufo[i].dist() > R + EPS && !isfinished[i] && ufo[i].laser(x, y) ) {
                        isfinished[i] = true;
                    }
                }
            }
        }
        for ( int i = 0; i < N; i++ ) {
            if ( !isfinished[i] ) {
                cnt++;
            }
        }
        cout << cnt << endl;
    }

    return ( 0 );
}

