#include <bits/stdc++.h>   using namespace std;   queue<int> fila;   struct G {     double d;     int m, p, r;   } g[250002];   bool mk[250002];   int a2[9000000];   bool cmp2(int a, int b) { return g[a].d < g[b].d; }   int pos = 0;   int ind = 0;   struct T {     int m;     int* e;     void pdt(int a, int* b) { m = a, e = b; }   } mas[2 * 250002];   bool cmp(T a, T b) { return a.m < b.m; }   int ls[4 * 250002];   int s[4 * 250002][2];   int r[4 * 250002];   int build(int a, int b, int f) {     int p = ind++;     ls[p] = pos;     r[p] = b;     int i = ls[f];     for (int i = ls[f]; a2[i] >= 0; i++) {       if (g[a2[i]].m >= a && g[a2[i]].m <= b) a2[pos] = a2[i], pos++;     }     a2[pos] = -1;     pos++;     if (a != b)       s[p][0] = build(a, (a + b) / 2, p),       s[p][1] = build(((a + b) / 2) + 1, b, p);     else       s[p][0] = s[p][1] = -1;     return p;   }   void get(int p, int power, int ray) {     if (r[p] <= power) {       for (int i = ls[p]; a2[i] >= 0; i++) {         if (g[a2[i]].d <= ray + 1e-2) {           if (!mk[a2[i]]) fila.push(a2[i]), mk[a2[i]] = true;           ls[p] = i + 1;         } else           break;       }     } else {       get(s[p][0], power, ray);       if (power > r[s[p][0]]) get(s[p][1], power, ray);     }   }   int main() {     double x0, y0;     int pp, rr, n;     scanf( %lf %lf %d %d %d , &x0, &y0, &pp, &rr, &n);     int tot = 0;     mas[tot++].pdt(pp, &pp);     double x, y;     for (int i = 0; i < n; i++) {       scanf( %lf %lf %d %d %d , &x, &y, &g[i].m, &g[i].p, &g[i].r);       x -= x0;       y -= y0;       g[i].d = sqrt(x * x + y * y);       mk[i] = false;       a2[i] = i;       mas[tot++].pdt(g[i].m, &g[i].m), mas[tot++].pdt(g[i].p, &g[i].p);     }     a2[n] = -1;     sort(mas, mas + tot, cmp);     int v = 1;     int tmp = mas[0].m;     *mas[0].e = v;     for (int i = 1; i < tot; i++) {       if (mas[i].m != tmp) v++;       tmp = mas[i].m;       *mas[i].e = v;     }     sort(a2, a2 + n, cmp2);     r[0] = v;     ls[0] = 0;     ind = 1;     pos = n + 1;     if (n >= 2) s[0][0] = build(1, v / 2, 0), s[0][1] = build((v / 2) + 1, v, 0);     get(0, pp, rr);     int resp = 0;     while (fila.size()) {       resp++;       int u = fila.front();       fila.pop();       get(0, g[u].p, g[u].r);     }     printf( %d n , resp);     return 0;   }   