#include <bits/stdc++.h>
using namespace std;
int const N = 200;
int r[N], n, w, m;
struct P {
  int x, y;
  P(int a = 0, int b = 0) : x(a), y(b) {}
  void sc() { scanf("%d%d", &x, &y); }
  P operator-(P const &o) const { return P(x - o.x, y - o.y); }
  P operator+(P const &o) const { return P(x + o.x, y + o.y); }
  double ang() const { return atan2(y, x); }
  bool operator<(P const &o) const { return ang() < o.ang(); }
  P operator-() { return P(-x, -y); }
  long long L() const { return (long long)x * x + (long long)y * y; }
  long long operator*(P const &o) const {
    return (long long)x * o.x + (long long)y * o.y;
  }
  long long operator|(P const &o) const {
    return (long long)x * o.y - (long long)y * o.x;
  }
} g[N];
vector<P> v;
void ad(vector<P> &v, P &o, vector<P> const &a) {
  int mn = 0;
  for (int i = 1; i < (int)(a.size()); ++i)
    if (a[i].y > a[mn].y || a[i].y == a[mn].y && a[i].x < a[mn].x) mn = i;
  o = o + a[mn];
  for (int i = mn; i < (int)(a.size() - 1); ++i) v.push_back(a[i + 1] - a[i]);
  v.push_back(a[0] - a.back());
  for (int i = 0; i < (int)(mn); ++i) v.push_back(a[i + 1] - a[i]);
}
vector<P> J(vector<P> const &a, vector<P> const &b) {
  vector<P> v;
  P o;
  ad(v, o, a);
  ad(v, o, b);
  inplace_merge(v.begin(), v.begin() + a.size(), v.end());
  P t = v[0];
  v[0] = o;
  for (int i = 1; i < (int)(v.size()); ++i) {
    P tt = v[i];
    v[i] = t + v[i - 1];
    t = tt;
  }
  return v;
}
long long ds(P const &a, P const &b, P const &c) {
  if ((a - b) * (c - b) < 0 || (b - a) * (c - a) < 0) return 1e18;
  long long z = a - b | c - b;
  return z * z / (a - b).L();
}
bool sad(int a, int b) {
  P p = g[a] - g[b];
  int rr = r[a] + r[b];
  for (int i = 0; i < (int)(v.size()); ++i)
    if ((p - v[i]).L() < (long long)rr * rr) return true;
  for (int i = 0; i < (int)(v.size()); ++i)
    if (ds(v[i], v[i + 1 == v.size() ? 0 : i + 1], p) < rr * rr) return true;
  bool in = true;
  for (int i = 0; i < (int)(v.size()); ++i)
    if ((v[i + 1 == v.size() ? 0 : i + 1] - v[i] | p - v[i]) < 0) {
      in = false;
      break;
    }
  return in;
}
namespace MF {
int const N = 402, M = 1000000;
int E, Pa[N], VIS[N], VS, SR, TR;
vector<int> G[N];
pair<int, int> Ed[M];
bool path(int v = SR) {
  if (v == TR) return true;
  VIS[v] = VS;
  for (int i = 0; i < (int)(G[v].size()); ++i) {
    pair<int, int> &e = Ed[G[v][i]];
    if (e.second == 0) continue;
    if (VIS[e.first] != VS && path(e.first)) {
      Pa[e.first] = G[v][i];
      return true;
    }
  }
  return false;
}
int fix() {
  int an = 2e9, v = TR;
  while (v != SR) {
    int e = Pa[v];
    an = min(an, Ed[e].second);
    v = Ed[e ^ 1].first;
  }
  v = TR;
  while (v != SR) {
    int e = Pa[v];
    Ed[e].second -= an;
    Ed[e ^ 1].second += an;
    v = Ed[e ^ 1].first;
  }
  return an;
}
inline int MF(int a, int b) {
  SR = a, TR = b;
  int an = 0;
  ++VS;
  while (path()) an += fix(), ++VS;
  return an;
}
inline void aded(int a, int b, int w1 = 1, int w2 = 0) {
  Ed[E] = make_pair(b, w1);
  Ed[E + 1] = make_pair(a, w2);
  G[a].push_back(E++);
  G[b].push_back(E++);
}
inline void CL() {
  E = 0;
  for (int i = 0; i < (int)(N); ++i) G[i].clear();
}
}  // namespace MF
int main() {
  scanf("%d%d", &n, &w);
  v.resize(n);
  for (int i = 0; i < (int)(n); ++i) v[i].sc();
  int mnx = 1e9, mxx = -1e9;
  for (int i = 0; i < (int)(n); ++i) {
    mnx = min(mnx, v[i].x);
    mxx = max(mxx, v[i].x);
  }
  vector<P> u = v;
  for (int i = 0; i < (int)(n); ++i) u[i] = -u[i];
  v = J(v, u);
  scanf("%d", &m);
  for (int i = 0; i < (int)(m); ++i) {
    g[i].sc();
    scanf("%d", r + i);
  }
  for (int i = 0; i < (int)(m); ++i) MF::aded(i << 1, i << 1 | 1);
  for (int i = 0; i < (int)(m); ++i)
    for (int j = i + 1; j < (int)(m); ++j)
      if (sad(i, j)) {
        MF::aded(i << 1 | 1, j << 1, 1e9);
        MF::aded(j << 1 | 1, i << 1, 1e9);
      }
  for (int i = 0; i < (int)(m); ++i)
    if (g[i].x - r[i] < mxx - mnx) MF::aded(m << 1, i << 1, 1e9);
  for (int i = 0; i < (int)(m); ++i)
    if (g[i].x + r[i] > w - (mxx - mnx)) MF::aded(i << 1 | 1, m << 1 | 1, 1e9);
  printf("%d\n", MF::MF(m << 1, m << 1 | 1));
}
