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;
struct pt {
  long long x, y;
  pt(long long x, long long y) : x(x), y(y) {}
  pt() : x(0), y(0) {}
  void read() { scanf("%I64d%I64d", &x, &y); }
  pt operator+(const pt& a) { return pt(a.x + x, a.y + y); }
  pt operator-(const pt& a) { return pt(x - a.x, y - a.y); }
  pt operator*(double k) { return pt(x * k, y * k); }
};
struct line {
  long long a, b, c;
  line(pt& p, pt& q) {
    a = p.y - q.y;
    b = q.x - p.x;
    c = -(a * p.x + b * p.y);
  }
};
double ang(const pt& p) { return atan2(p.y, p.x); }
int k, n, q;
const int N = 500 * 1000 + 5;
pt EV[N];
pt P[N];
pt V[N];
int T[N];
int CNT[N];
pt v[N];
bool cmp(const pt& a, const pt& b) { return ang(a) < ang(b); }
void read() {
  scanf("%d%d%d", &k, &n, &q);
  for (int i = 0; i < k; ++i) V[i].read();
  for (int i = 0; i < n; ++i) {
    P[i].read();
    scanf("%d", &CNT[i]);
  }
  for (int i = 0; i < q; ++i) {
    EV[i].read();
    scanf("%d", &T[i]);
  }
}
long long ans[N];
long long f[N];
void inc(int pos, int d) {
  for (; pos < N; pos |= pos + 1) f[pos] += d;
}
long long get(int pos) {
  long long res = 0;
  for (; pos >= 0; pos = (pos & (pos + 1)) - 1) res += f[pos];
  return res;
}
long long get(int l, int r) { return get(r) - get(l - 1); }
double PI = 3.1415926535897932384626433832795;
void solve() {
  for (int i = 0; i < k; ++i) {
    V[i] = V[i] * 2;
    V[i + k] = V[i] * -1;
  }
  sort(V, V + 2 * k, cmp);
  v[0] = pt(0, 0);
  for (int i = 1; i < 2 * k; ++i) v[i] = v[i - 1] + V[i - 1];
  pt c(0, 0);
  for (int i = 0; i < 2 * k; ++i) c = c + v[i];
  c = c * (1 / (2.0 * k));
  for (int i = 0; i < 2 * k; ++i) v[i] = v[i] - c;
  int sig[33];
  long long maxx = v[0].x;
  for (int i = 0; i < 2 * k; ++i) maxx = max(maxx, v[i].x);
  for (int _i = 0; _i < 2 * k; ++_i) {
    int _j = (_i + 1) % (2 * k);
    sig[_i] = 1;
    if (v[_i].x == v[_j].x) sig[_i] = 0;
    if (v[_i].x < v[_j].x) sig[_i] = -1;
  }
  for (int _i = 0; _i < 2 * k; ++_i) {
    vector<pair<long long, int> > ev;
    vector<long long> xs;
    memset(f, 0, sizeof f);
    int _j = (_i + 1) % (2 * k);
    line l(v[_i], v[_j]);
    double c = -l.a;
    if (l.b < 0) l.b *= -1, c *= -1;
    if (v[_i].x == v[_j].x) continue;
    for (int i = 0; i < n; ++i) {
      long long cy = P[i].y * l.b - P[i].x * c;
      if (sig[_i] == -1) cy++;
      ev.push_back(make_pair(cy, i));
      xs.push_back(P[i].x);
    }
    for (int i = 0; i < q; ++i) {
      pt p = EV[i] + v[_i] * T[i];
      long long cy = p.y * l.b - c * p.x;
      ev.push_back(make_pair(cy, i + n));
      xs.push_back(p.x);
      xs.push_back(p.x - 1);
      xs.push_back((EV[i] + v[_j] * T[i]).x);
      xs.push_back((EV[i] + v[_j] * T[i]).x - 1);
    }
    sort(ev.begin(), ev.end(),
         [](const pair<long long, int>& a, const pair<long long, int>& b) {
           if (a.first != b.first) return a.first < b.first;
           return a.second < b.second;
         });
    sort(xs.begin(), xs.end());
    xs.resize(unique(xs.begin(), xs.end()) - xs.begin());
    for (int i = 0; i < ev.size(); ++i) {
      if (ev[i].second < n) {
        int j = ev[i].second;
        inc(lower_bound(xs.begin(), xs.end(), P[j].x) - xs.begin(), CNT[j]);
      } else {
        int j = ev[i].second - n;
        pt p1 = EV[j] + v[_i] * T[j];
        pt p2 = EV[j] + v[_j] * T[j];
        if (p1.x > p2.x) swap(p1.x, p2.x);
        long long l = p1.x, r = p2.x;
        if (v[_i].x != maxx && v[_j].x != maxx) r--;
        ans[j] +=
            sig[_i] * get(lower_bound(xs.begin(), xs.end(), l) - xs.begin(),
                          lower_bound(xs.begin(), xs.end(), r) - xs.begin());
      }
    }
  }
  for (int i = 0; i < q; ++i) printf("%I64d\n", ans[i]);
}
int main() {
  srand(time(NULL));
  read();
  solve();
  return 0;
}