// This file is a "Hello, world!" in C++ language by GCC for wandbox.
#include <iostream>
#include <cstdlib>
#include <vector>
#include <cmath>
#include <algorithm>

int main()
{
    struct P {
        float x, y;
    };
    
    struct UFO {
        float x, y;
        float v;
        float r;
        float sita;
        float d;
    };
    
    while (true) {
        int count = 0;
        int R, N;
        std::cin >> R >> N;
        
        if (R == 0 && N == 0) {
            break;
        }
        
        std::vector<UFO> ufos(N);
        
        for (int i = 0; i < N; i++) {
            std::cin >> ufos[i].x >> ufos[i].y >> ufos[i].r >> ufos[i].v;
            ufos[i].sita = std::atan2(ufos[i].y, ufos[i].x);
            ufos[i].d = std::sqrt(ufos[i].x * ufos[i].x + ufos[i].y * ufos[i].y);
        }
        
        while (!ufos.empty()) {
            for (std::size_t i = 0; i < ufos.size(); i++) {
                ufos[i].d = std::max(ufos[i].d - ufos[i].v, 0.0f);
                ufos[i].x = std::cos(ufos[i].sita) * ufos[i].d;
                ufos[i].y = std::sin(ufos[i].sita) * ufos[i].d;
            }
            
            count += std::count_if(ufos.begin(), ufos.end(), [R](auto& elem){
                return elem.d <= R;
            });
            
            {
                auto rm_it = std::remove_if(ufos.begin(), ufos.end(), [R](auto& elem){
                    return elem.d <= R;
                });
                ufos.erase(rm_it, ufos.end());
            }
            
            std::sort(ufos.begin(), ufos.end(), [](auto& lhs, auto& rhs){
                return lhs.d < rhs.d;
            });
            
            if (ufos.empty()) {
                break;
            }
            
            float a = ufos[0].y / ufos[0].x;
            {
                auto rm_it = std::remove_if(ufos.begin(), ufos.end(), [R, a, &ufos](auto& elem){
                    float d = std::abs(-a * elem.x + elem.y) / std::sqrt(a * a + 1);
                    return elem.r >= d + 1e-6 && (ufos[0].sita * elem.sita) >= 0;
                });
                ufos.erase(rm_it, ufos.end());
            }
        }
        printf("%d\n", count);
    }
}

