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>
const int MAXN = 100010;
struct vec {
  long long x, y;
  vec() { x = y = 0; }
  vec(long long a, long long b) { x = a, y = b; }
  long long operator^(vec b) const { return x * b.y - y * b.x; }
  long long operator*(vec b) const { return x * b.x + y * b.y; }
  long long norm2() const { return x * x + y * y; }
  vec operator-(vec b) const { return vec(x - b.x, y - b.y); }
  vec operator+(vec b) const { return vec(x + b.x, y + b.y); }
  vec operator*(int k) const { return vec(x * k, y * k); }
  friend bool operator<(const vec& a, const vec& b) { return (a ^ b) > 0; }
  friend std::istream& operator>>(std::istream& in, vec& x) {
    in >> x.x >> x.y;
    return in;
  }
  friend std::ostream& operator<<(std::ostream& out, vec x) {
    out << '(' << x.x << ',' << x.y << ')';
    return out;
  }
} ps[MAXN], qs[MAXN], cs[110];
int ts[MAXN], A[MAXN];
long long ansl[MAXN];
inline long long cross(vec a, vec b, vec c) { return (b - a) ^ (c - a); }
int K, n, Q;
bool polar(vec x) { return x.y == 0 ? x.x < 0 : x.y < 0; }
bool polarcmp(vec a, vec b) {
  return polar(a) == polar(b) ? a < b : polar(a) < polar(b);
}
const int MAXL = MAXN * 3;
long long tree[MAXL];
int bitsz;
void add(int x, int v) {
  for (; x <= bitsz; x += x & -x) tree[x] += v;
}
long long qry(int x) {
  long long res = 0;
  for (; x; x &= x - 1) res += tree[x];
  return res;
}
struct _ {
  int pol, dis, tar, coef;
  bool operator<(const _& b) const { return pol < b.pol; }
} qrys[MAXL];
int bak;
template <typename T>
int discretization(T arr, int L, int* tar) {
  std::sort(arr + 1, arr + 1 + L);
  int rnk = 0;
  for (int i = 1; i <= L; ++i) {
    rnk += !(i != 1 && !(arr[i - 1].first < arr[i].first) &&
             !(arr[i].first < arr[i - 1].first));
    tar[arr[i].second] = rnk;
  }
  return rnk;
}
inline int sgn(long long x) { return x < 0 ? -1 : x > 0; }
long long tmp[MAXN], col[MAXN];
long long get(vec x, vec y) { return y.x ? std::abs(y ^ x) : x.x; }
int rec[21][MAXN];
bool close[21][MAXN];
int main() {
  std::ios_base::sync_with_stdio(false), std::cin.tie(0);
  std::cin >> K >> n >> Q;
  for (int i = 1; i <= K; ++i) std::cin >> cs[i], cs[i + K] = cs[i] * -1;
  for (int i = 1; i <= n; ++i) std::cin >> ps[i] >> A[i];
  for (int i = 1; i <= Q; ++i) std::cin >> qs[i] >> ts[i];
  K <<= 1;
  std::sort(cs + 1, cs + 1 + K, polarcmp);
  vec sm;
  for (int i = 1; i <= K; ++i) sm = sm + (cs[i] = cs[i - 1] + cs[i]);
  assert(sm.x % (K / 2) == 0);
  assert(sm.y % (K / 2) == 0);
  sm.x /= K / 2, sm.y /= K / 2;
  for (int i = 1; i <= K; ++i) cs[i] = cs[i] * 2 - sm;
  cs[K + 1] = cs[1];
  vec ori(-2e9, -2e9);
  for (int i = 1; i <= Q; ++i) {
    for (int j = 1; j <= K; ++j) {
      vec x = cs[j] * ts[i] + qs[i], y = cs[j + 1] * ts[i] + qs[i];
      rec[j][i] = sgn(cross(ori, x, y));
    }
    for (int j = 1; j <= K; ++j)
      if (rec[j == K ? 1 : j + 1][i] != rec[j][i]) close[j][i] = true;
  }
  for (int T = 1; T <= K; ++T) {
    vec X = cs[T], Y = cs[T + 1], D = X - Y;
    if (D.x < 0) D = D * -1;
    static std::pair<vec, int> tv[MAXL];
    static std::pair<long long, int> td[MAXL];
    static int nv[MAXL], nd[MAXL];
    bak = 0;
    for (int i = 1; i <= n; ++i) {
      ++bak, tv[bak] = std::pair<vec, int>(ps[i] - ori, bak);
      td[bak] = std::pair<long long, int>(get(ps[i] - ori, D), bak);
      qrys[bak].tar = 0, qrys[bak].coef = A[i];
    }
    for (int i = 1; i <= Q; ++i) {
      vec x = X * ts[i] + qs[i], y = Y * ts[i] + qs[i];
      ++bak, tv[bak] = std::pair<vec, int>(x - ori, bak);
      td[bak] = std::pair<long long, int>(get(x - ori, D), bak);
      qrys[bak].tar = i, qrys[bak].coef = 1;
      ++bak, tv[bak] = std::pair<vec, int>(y - ori, bak);
      td[bak] = std::pair<long long, int>(get(y - ori, D), bak);
      qrys[bak].tar = i, qrys[bak].coef = -1;
    }
    int vsz = discretization(tv, bak, nv);
    bitsz = discretization(td, bak, nd);
    for (int i = 1; i <= bak; ++i) {
      qrys[i].pol = nv[i];
      qrys[i].dis = nd[i];
    }
    for (int i = 1; i <= bak; ++i)
      if (int u = qrys[i].tar) {
        if (rec[T][u] == 1) --qrys[i].pol;
        if (qrys[i].coef == -1 && close[T][u]) qrys[i].pol += rec[T][u];
      }
    std::sort(qrys + 1, qrys + 1 + bak);
    int L = 1, R = 1;
    for (int i = 1; i <= vsz; ++i) {
      while (L <= bak && qrys[L].pol < i) ++L;
      while (R <= bak && qrys[R].pol <= i) ++R;
      for (int j = L; j < R; ++j)
        if (qrys[j].tar == 0) add(qrys[j].dis, qrys[j].coef);
      for (int j = L; j < R; ++j)
        if (qrys[j].tar > 0) {
          long long a = qry(qrys[j].dis), b = qry(qrys[j].dis - 1);
          tmp[qrys[j].tar] += a * qrys[j].coef;
          col[qrys[j].tar] += (a - b) * qrys[j].coef;
        }
      L = R;
    }
    for (int i = 1; i <= Q; ++i) {
      tmp[i] = std::abs(tmp[i]);
      col[i] = std::abs(col[i]);
      if (rec[T][i] == -1) tmp[i] -= col[i];
      ansl[i] += tmp[i] * rec[T][i];
      tmp[i] = col[i] = 0;
    }
    memset(tree, 0, bitsz + 1 << 3);
  }
  for (int i = 1; i <= Q; ++i) std::cout << ansl[i] << '\n';
  return 0;
}