#include <iostream>
#include <algorithm>
#include <list>
using namespace std;

inline double sq(double d) {
  return d * d;
}

struct V2 {
  double x, y;

  V2(const double& x, const double& y) {
    this->x = x;
    this->y = y;
  }
  V2() {}

  double cross_product(const V2& other) {
    return abs(y * other.x - x * other.y);
  }
};

struct UFO {
  V2 pos;
  int speed;
  int radius;
  double distance;
  V2 dir;

  UFO(const V2& pos, const int& speed, const int& radius) {
    this->pos = pos;
    this->speed = speed;
    this->radius = radius;
    this->distance = sqrt(sq(pos.x) + sq(pos.y));
    this->dir = V2(pos.x / distance, pos.x / distance);
  }
  UFO() {}

  void update() {
    distance = max(distance - speed, 0.0);
    pos.x = max(pos.x - dir.x * speed, 0.0);
    pos.y = max(pos.y - dir.y * speed, 0.0);
  }

  bool hit_with(const UFO& targeted_ufo, double ineffective_distance) {
    // cover?
    double distance_to_target_line = pos.cross_product(targeted_ufo.pos) / targeted_ufo.distance;
    if (distance_to_target_line >= this->radius) return false;
    // effective?
    return sqrt(sq(this->distance) - sq(distance_to_target_line)) + sqrt(sq(this->radius) - sq(distance_to_target_line)) > ineffective_distance;
  }
};

int main() {
  double ineffective_distance;
  int n;
  list<UFO> ufos(100);
  while (cin >> ineffective_distance >> n, n) {
    ufos.clear();
    // load
    while (n--) {
      double x, y;
      int r, v;
      cin >> x >> y >> r >> v;
      ufos.push_back(UFO(V2(x, y), v, r));
    }

    // calc
    int reached = 0;
    while (!ufos.empty()) {
      double target_distance = 1 << 16;
      auto target = ufos.end();
      // update & targeting
      for (auto it = ufos.begin(); it != ufos.end();) {
        auto& ufo = *it;
        ufo.update();
        if (ufo.distance <= ineffective_distance) {
          reached++;
          it = ufos.erase(it);
        } else {
          if (ufo.distance < target_distance) {
            target_distance = ufo.distance;
            target = it;
          }
          it++;
        }
      }

      // no target
      if (target == ufos.end()) break;
      UFO target_copy = *target;

      // shot
      for (auto it = ufos.begin(); it != ufos.end();) {
        if (it == target || it->hit_with(target_copy, ineffective_distance)) {
          it = ufos.erase(it);
        } else {
          it++;
        }
      }
    }
    cout << reached << endl;
  }
  return 0;
}