#include <iostream>
#include <sstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <climits>
#include <cfloat>
using namespace std;

const double EPS = 1.0e-10;

class Point
{
public:
    double y, x;
    Point(){
        y = x = 0.0;
    }
    Point(double y0, double x0){
        y = y0;
        x = x0;
    }
    Point operator+(const Point& p) const{
        return Point(y + p.y, x + p.x);
    }
    Point operator-(const Point& p) const{
        return Point(y - p.y, x - p.x);
    }
    Point operator*(double a) const{
        return Point(y * a, x * a);
    }
    Point operator/(double a) const{
        return Point(y / a, x / a);
    }
    double length() const{
        return sqrt(y * y + x * x);
    }
    double dist(const Point& p) const{
        return sqrt(pow(y - p.y, 2) + pow(x - p.x, 2));
    }
    double dot(const Point& p) const{
        return y * p.y + x * p.x; // |a|*|b|*cosÆ
    }
    double cross(const Point& p) const{
        return x * p.y - y * p.x; // |a|*|b|*sinÆ
    }
};

class Line
{
public:
    double a, b, c; // a*x + b*y + c = 0
    Line(){
        a = c = 0.0;
        b = 1.0;
    }
    Line(double a0, double b0, double c0){
        a = a0;
        b = b0;
        c = c0;
    }
    Line(const Point& p1, const Point& p2){ // 2_ðÔ¼ü
        double dy = p2.y - p1.y;
        double dx = p2.x - p1.x;
        if(abs(dy / dx) < EPS){
            a = 0.0;
            b = 1.0;
            c = -p1.y;
        }else if(abs(dx / dy) < EPS){
            a = 1.0;
            b = 0.0;
            c = -p1.x;
        }else{
            a = - dy / dx;
            b = 1.0;
            c = dy / dx * p1.x - p1.y;
        }
    }
};

int circleLineIntersection(const Point& p, double r, const Line& l, vector<Point>& intersection)
{
    double s = l.a * p.x + l.b * p.y + l.c;
    double t = (l.a*l.a + l.b*l.b) * r*r - s*s;

    if(t < -EPS){
        intersection.resize(0);
        return 0;
    }
    if(t < EPS){
        intersection.assign(1, Point(l.b, l.a) * (-s / (l.a*l.a + l.b*l.b)) + p);
        return 1;
    }

    intersection.assign(2, Point(l.a, -l.b) * sqrt(t));
    intersection[1] = intersection[1] * -1;
    for(int i=0; i<2; ++i)
        intersection[i] = (intersection[i] - Point(l.b, l.a) * s) / (l.a*l.a + l.b*l.b) + p;
    return 2;
}

int main()
{
    for(;;){
        int d, n;
        cin >> d >> n;
        if(d == 0)
            return 0;

        vector<Point> p(n);
        vector<int> r(n), v(n);
        for(int i=0; i<n; ++i)
            cin >> p[i].x >> p[i].y >> r[i] >> v[i];

        vector<bool> check(n, false);
        int ret = 0;
        for(;;){
            for(int i=0; i<n; ++i){
                if(!check[i]){
                    if(p[i].length() - v[i] < d + EPS){
                        check[i] = true;
                        ++ ret;
                    }else{
                        p[i] = p[i] - p[i] / p[i].length() * v[i];
                    }
                }
            }

            int j = -1;
            double minDist = DBL_MAX;
            for(int i=0; i<n; ++i){
                if(!check[i] && p[i].length() < minDist){
                    minDist = p[i].length();
                    j = i;
                }
            }
            if(j == -1)
                break;

            Line line(Point(0,0), p[j]);
            for(int i=0; i<n; ++i){
                vector<Point> tmp;
                if(!check[i] && ((p[i].dot(p[j]) > 0 && circleLineIntersection(p[i], r[i], line, tmp) > 0) || p[i].dist(p[j]) < r[i]))
                    check[i] = true;
            }
        }

        cout << ret << endl;
    }
}

Measured memory_bytes: 0