### main

while true
  rlimit, n = gets.strip.split(' ').map{|s| s.to_i}
  break if rlimit == 0 && n == 0

  rlimit2 = rlimit ** 2

  ufos = []
  count = 0

  n.times.each do
    x0, y0, r, v = gets.strip.split(' ').map{|s| s.to_i}

    d2 = x0 ** 2 + y0 ** 2
    if d2 <= rlimit2
      count += 1
    else
      d = Math.sqrt(d2)
      vx = -x0.to_f * v / d
      vy = -y0.to_f * v / d
      ufos << [nil, nil, nil, x0, y0, vx, vy, r * r]
    end
  end

  t = 1

  while ! ufos.empty?
    #puts "t=#{t}"

    for u in ufos
      u[0] = u[5] * t + u[3]
      u[1] = u[6] * t + u[4]
      u[2] = u[0] ** 2 + u[1] ** 2
    end

    ufos0 = ufos.sort{|a, b| a[2] <=> b[2]}
    min_u = nil
    lx = ly = lxy2 = nil

    for u0 in ufos0
      #p ['u0'] + u0
      ux, uy, ud2, uox, uoy, uvx, uvy, ur2 = u0

      if ud2 <= rlimit2
        count += 1
        ufos.delete(u0)
        #puts "  d2=#{u0[2]}, rlimit2=#{rlimit2}: enter (delete)"
        next
      end

      if min_u.nil?
        min_u = u0
        lx = uox
        ly = uoy
        lxy2 = lx ** 2 + ly ** 2
        ## lazer: ly * x - lx * y = 0
        ufos.delete(u0)
        #puts "  nearest (delete)"
        next
      end

      ld2 = ((ly * ux - lx * uy) ** 2).to_f / lxy2
      if ld2 <= ur2 && lx * ux + ly * uy > 0
        cx = (ux * lx * lx + uy * lx * ly) / lxy2
        cy = (ux * lx * ly + uy * ly * ly) / lxy2
        dc = Math.sqrt(cx ** 2 + cy ** 2)
        delta = Math.sqrt(ur2 - ld2)
        #puts "ld2=#{ld2}, dc=#{dc}, delta=#{delta}"
        #puts "dc-delta=#{dc-delta}, rlimit2=#{rlimit2}"

        if (dc - delta) ** 2 > rlimit2 && lx * cx + ly * cy > 0
          ufos.delete(u0)
          #puts "  dr2=#{ld2/lxy2} <= r2=#{u0[7]} : hit (delete)"
        end
      end
    end

    t += 1
  end

  puts count
end