Problem: After long-term research and lots of experiments leading Megapolian automobile manufacturer «AutoVoz» released a brand new car model named «Lada Malina». One of the most impressive features of «Lada Malina» is its highly efficient environment-friendly engines.

Consider car as a point in Oxy plane. Car is equipped with k engines numbered from 1 to k. Each engine is defined by its velocity vector whose coordinates are (vxi, vyi) measured in distance units per day. An engine may be turned on at any level wi, that is a real number between  - 1 and  + 1 (inclusive) that result in a term of (wi·vxi, wi·vyi) in the final car velocity. Namely, the final car velocity is equal to 

(w1·vx1 + w2·vx2 + ... + wk·vxk, w1·vy1 + w2·vy2 + ... + wk·vyk)

Formally, if car moves with constant values of wi during the whole day then its x-coordinate will change by the first component of an expression above, and its y-coordinate will change by the second component of an expression above. For example, if all wi are equal to zero, the car won't move, and if all wi are equal to zero except w1 = 1, then car will move with the velocity of the first engine.

There are n factories in Megapolia, i-th of them is located in (fxi, fyi). On the i-th factory there are ai cars «Lada Malina» that are ready for operation.

As an attempt to increase sales of a new car, «AutoVoz» is going to hold an international exposition of cars. There are q options of exposition location and time, in the i-th of them exposition will happen in a point with coordinates (pxi, pyi) in ti days. 

Of course, at the «AutoVoz» is going to bring as much new cars from factories as possible to the place of exposition. Cars are going to be moved by enabling their engines on some certain levels, such that at the beginning of an exposition car gets exactly to the exposition location. 

However, for some of the options it may be impossible to bring cars from some of the factories to the exposition location by the moment of an exposition. Your task is to determine for each of the options of exposition location and time how many cars will be able to get there by the beginning of an exposition.

Input

The first line of input contains three integers k, n, q (2 ≤ k ≤ 10, 1 ≤ n ≤ 105, 1 ≤ q ≤ 105), the number of engines of «Lada Malina», number of factories producing «Lada Malina» and number of options of an exposition time and location respectively.

The following k lines contain the descriptions of «Lada Malina» engines. The i-th of them contains two integers vxi, vyi ( - 1000 ≤ vxi, vyi ≤ 1000) defining the velocity vector of the i-th engine. Velocity vector can't be zero, i.e. at least one of vxi and vyi is not equal to zero. It is guaranteed that no two velosity vectors are collinear (parallel).

Next n lines contain the descriptions of factories. The i-th of them contains two integers fxi, fyi, ai ( - 109 ≤ fxi, fyi ≤ 109, 1 ≤ ai ≤ 109) defining the coordinates of the i-th factory location and the number of cars that are located there.

The following q lines contain the descriptions of the car exposition. The i-th of them contains three integers pxi, pyi, ti ( - 109 ≤ pxi, pyi ≤ 109, 1 ≤ ti ≤ 105) defining the coordinates of the exposition location and the number of days till the exposition start in the i-th option.

Output

For each possible option of the exposition output the number of cars that will be able to get to the exposition location by the moment of its beginning.

Examples

Input

2 4 1
1 1
-1 1
2 3 1
2 -2 1
-2 1 1
-2 -2 1
0 0 2


Output

3


Input

3 4 3
2 0
-1 1
-1 -2
-3 0 6
1 -2 1
-3 -7 3
3 2 2
-1 -4 1
0 4 2
6 0 1


Output

4
9
0

Note

Images describing sample tests are given below. Exposition options are denoted with crosses, factories are denoted with points. Each factory is labeled with a number of cars that it has.

First sample test explanation:

  * Car from the first factory is not able to get to the exposition location in time. 
  * Car from the second factory can get to the exposition in time if we set w1 = 0, w2 = 1. 
  * Car from the third factory can get to the exposition in time if we set <image>, <image>. 
  * Car from the fourth factory can get to the exposition in time if we set w1 = 1, w2 = 0. 

<image> <image>

Solution (in CPP):

Solution:
#include <bits/stdc++.h>
using namespace std;
const int Imx = 2147483647;
const long long Lbig = 2e18;
const int mod = 1e9 + 7;
struct fastio {
  char s[100000];
  int it, len;
  fastio() { it = len = 0; }
  inline char get() {
    if (it < len) return s[it++];
    it = 0;
    len = fread(s, 1, 100000, stdin);
    if (len == 0)
      return EOF;
    else
      return s[it++];
  }
  bool notend() {
    char c = get();
    while (c == ' ' || c == '\n') c = get();
    if (it > 0) it--;
    return c != EOF;
  }
} _buff;
inline long long getnum() {
  long long r = 0;
  bool ng = 0;
  char c;
  c = _buff.get();
  while (c != '-' && (c < '0' || c > '9')) c = _buff.get();
  if (c == '-') ng = 1, c = _buff.get();
  while (c >= '0' && c <= '9') r = r * 10 + c - '0', c = _buff.get();
  return ng ? -r : r;
}
template <class T>
inline void putnum(T x) {
  if (x < 0) putchar('-'), x = -x;
  register short a[20] = {}, sz = 0;
  while (x) a[sz++] = x % 10, x /= 10;
  if (sz == 0) putchar('0');
  for (int i = sz - 1; i >= 0; i--) putchar('0' + a[i]);
}
inline char getreal() {
  char c = _buff.get();
  while (c == ' ' || c == '\n') c = _buff.get();
  return c;
}
struct point {
  int x, y;
  point(int X = 0, int Y = 0) {
    x = X;
    y = Y;
  }
  point operator+(const point &t) { return point(x + t.x, y + t.y); }
  point operator-(const point &t) { return point(x - t.x, y - t.y); }
  point operator-() { return point(-x, -y); }
  int det(const point &t) { return x * t.y - y * t.x; }
  int dot(const point &t) { return x * t.x + y * t.y; }
};
point P[22];
int pn;
void addpoint(point p) {
  if (pn == 0)
    P[pn++] = p, P[pn++] = -p;
  else {
    if ((P[1] - P[0]).det(p) >= 0) p = -p;
    P[pn] = P[0];
    point Q[3] = {p, -p, p};
    int it0 = 0, it1 = 0;
    point nP[22];
    int nn = 0;
    for (int i = 0; i < pn + 2; i++) {
      nP[nn++] = P[it0] + Q[it1];
      if (it1 == 2 ||
          it0 < pn && (P[it0 + 1] - P[it0]).det(Q[it1 + 1] - Q[it1]) >= 0)
        it0++;
      else
        it1++;
    }
    swap(P, nP);
    swap(pn, nn);
  }
}
struct data {
  long long x, y, v;
  int id;
  void in(int i) {
    x = getnum(), y = getnum(), v = getnum();
    id = i;
  }
} a0[100111], b0[100111], a[100111], b[100111];
int k, n, m;
long long ans[100111];
pair<long long, int> pp[200111];
long long tab[100111];
long long vv[100111], vvn;
int findv(long long x) { return lower_bound(vv, vv + vvn, x) - vv + 1; }
void tabadd(int x, long long v) {
  for (int i = x; i <= 100005; i += i & (-i)) tab[i] += v;
}
long long tabsum(int x) {
  long long ret = 0;
  for (int i = x; i > 0; i -= i & (-i)) ret += tab[i];
  return ret;
}
void solve_query(long long coef) {
  vvn = 0;
  for (int i = 1; i <= n; i++) pp[i] = make_pair(a[i].y, i), vv[vvn++] = a[i].x;
  for (int i = 1; i <= m; i++) pp[n + i] = make_pair(b[i].v, n + i);
  sort(vv, vv + vvn);
  sort(pp + 1, pp + n + m + 1);
  memset(tab, 0, sizeof(tab));
  for (int i = 1; i <= n + m;) {
    int r = i;
    while (pp[i].first == pp[r].first) r++;
    for (int j = i; j < r; j++) {
      int id = pp[j].second;
      if (id <= n) {
        int pos = findv(a[id].x);
        tabadd(pos, a[id].v);
      }
    }
    for (int j = i; j < r; j++) {
      int id = pp[j].second;
      if (id > n) {
        id -= n;
        int pl = findv(b[id].x), pr = findv(b[id].y + 1) - 1;
        long long tmp = tabsum(pr) - tabsum(pl - 1);
        ans[b[id].id] += tmp * coef;
      }
    }
    i = r;
  }
}
void solve(long long p, long long q, long long xl, bool fl, long long xr,
           bool fr, long long B, long long coef) {
  for (int i = 1; i <= n; i++) {
    a[i].v = a0[i].v;
    a[i].x = a0[i].x;
    a[i].y = -a0[i].x * p + a0[i].y * q;
  }
  fl ^= 1;
  fr ^= 1;
  for (int i = 1; i <= m; i++) {
    b[i].x = b0[i].x + xl * b0[i].v + fl;
    b[i].y = b0[i].x + xr * b0[i].v - fr;
    b[i].id = i;
    b[i].v = -(b0[i].x + xl * b0[i].v) * p + (b0[i].y + B * b0[i].v) * q -
             (coef == -1);
  }
  solve_query(coef);
}
int main() {
  k = getnum(), n = getnum(), m = getnum();
  for (int i = 1; i <= k; i++) {
    point p;
    p.x = getnum(), p.y = getnum();
    addpoint(p);
  }
  P[pn] = P[0];
  int mn = P[0].x, mx = P[0].x;
  for (int i = 0; i < pn; i++) mn = min(mn, P[i].x), mx = max(mx, P[i].x);
  for (int i = 1; i <= n; i++) a0[i].in(i);
  for (int i = 1; i <= m; i++) b0[i].in(i);
  for (int i = 0; i < pn; i++) {
    if (P[i].x == P[i + 1].x) continue;
    long long xl, xr, p, q, B, coef;
    if (P[i + 1].x > P[i].x) {
      xl = P[i].x;
      xr = P[i + 1].x;
      q = xr - xl;
      p = P[i + 1].y - P[i].y;
      coef = -1;
      B = P[i].y;
    } else {
      xl = P[i + 1].x;
      xr = P[i].x;
      q = xr - xl;
      p = P[i].y - P[i + 1].y;
      coef = 1;
      B = P[i + 1].y;
    }
    solve(p, q, xl, 1, xr, xr == mx, B, coef);
  }
  for (int i = 1; i <= m; i++) putnum(ans[i]), putchar('\n');
  puts("");
  return 0;
}