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;
long double eps = 0.000000001;
struct p {
  long long x, y;
  p(long long x_ = 0, long long y_ = 0) {
    x = x_;
    y = y_;
  }
};
long double slope;
struct ev {
  long long x;
  long double y;
  int t, ind, cnt;
  ev(long long x_ = 0, long long y_ = 0, int cnt_ = 0, int t_ = 0,
     int ind_ = 0) {
    x = x_;
    y = y_ - x_ * slope;
    cnt = cnt_;
    t = t_;
    ind = ind_;
  }
};
long long cross(p a, p b, p c) {
  a.x -= b.x;
  a.y -= b.y;
  c.x -= b.x;
  c.y -= b.y;
  return a.x * c.y - a.y * c.x;
}
long long dist2(p a, p b) {
  return (a.x - b.x) * (a.x - b.x) + (a.y - b.y) * (a.y - b.y);
}
int n, k, q;
int wx[16], wy[16];
vector<p> poly;
p inputf[(1 << 20)], a[(1 << 20)];
long long anscnt[(1 << 20)];
long long acnt[(1 << 20)], t[(1 << 20)];
struct ver {
  int lind, rind;
  long long sum;
  ver() {
    lind = -1;
    rind = -1;
    sum = 0;
  }
} it[(1 << 22)];
p chcent;
bool cmpch(p a, p b) {
  long long ans = cross(a, chcent, b);
  if (ans == 0) {
    return dist2(a, chcent) < dist2(b, chcent);
  }
  return ans > 0;
}
vector<p> getHull(vector<p> pts) {
  vector<p> ans;
  if (pts.size() == 0) {
    return ans;
  }
  long long minind = 0;
  for (long long i = 1; i < pts.size(); i++) {
    if (pts[minind].y > pts[i].y ||
        (pts[minind].y == pts[i].y && pts[minind].x > pts[i].x)) {
      minind = i;
    }
  }
  swap(pts[minind], pts[0]);
  chcent = pts[0];
  sort(pts.begin() + 1, pts.end(), cmpch);
  for (long long i = 0; i < pts.size(); i++) {
    for (;
         ans.size() >= 2 && cross(ans[ans.size() - 2], ans.back(), pts[i]) >= 0;
         ans.pop_back()) {
    }
    ans.push_back(pts[i]);
  }
  return ans;
}
void generatePoly(int ind, int sumX, int sumY) {
  if (ind == k) {
    poly.push_back(p(sumX, sumY));
    return;
  }
  generatePoly(ind + 1, sumX + wx[ind], sumY + wy[ind]);
  generatePoly(ind + 1, sumX - wx[ind], sumY - wy[ind]);
}
int sz = 1;
long long xq, numq;
void add(long long l = (-1LL << 33), long long r = (1LL << 33), int ind = 0) {
  if (l == xq && r == xq + 1) {
    it[ind].sum += numq;
    return;
  }
  if (r <= xq || xq + 1 <= l) {
    return;
  }
  if (xq < (l + r) / 2) {
    if (it[ind].lind == -1) {
      it[sz] = ver();
      it[ind].lind = sz++;
    }
    add(l, (l + r) / 2, it[ind].lind);
  } else {
    if (it[ind].rind == -1) {
      it[sz] = ver();
      it[ind].rind = sz++;
    }
    add((l + r) / 2, r, it[ind].rind);
  }
  it[ind].sum += numq;
}
long long lq, rq;
long long getSum(long long ll = -(1LL << 33), long long rr = (1LL << 33),
                 int ind = 0) {
  if (ind == -1) {
    return 0;
  }
  if (lq <= ll && rr <= rq) {
    return it[ind].sum;
  }
  if (rr <= lq || rq <= ll) {
    return 0;
  }
  return getSum(ll, (ll + rr) / 2, it[ind].lind) +
         getSum((ll + rr) / 2, rr, it[ind].rind);
}
bool toS = 0;
bool cmpev(ev a, ev b) {
  if (abs(a.y - b.y) < eps) {
    if (a.t == b.t) {
      return a.x < b.x;
    } else {
      return (a.t > b.t) ^ toS;
    }
  }
  return a.y < b.y;
}
ev v[(1 << 20)];
int szv = 0;
void getCnt(p s, p f, bool isEnd) {
  if (s.x == f.x) {
    return;
  }
  slope = (f.y - s.y) / (double)(f.x - s.x);
  if (s.x < f.x) {
    toS = 0;
  } else {
    toS = 1;
  }
  szv = 0;
  it[0] = ver();
  sz = 1;
  for (int i = 0; i < q; i++) {
    v[szv++] = ev(inputf[i].x + s.x * t[i], inputf[i].y + s.y * t[i], -1, 1, i);
  }
  for (int i = 0; i < n; i++) {
    v[szv++] = ev(a[i].x, a[i].y, acnt[i], 0, i);
  }
  sort(v, v + szv, cmpev);
  for (int i = 0; i < szv; i++) {
    if (v[i].t == 0) {
      xq = v[i].x;
      numq = v[i].cnt;
      add();
    } else {
      int ind = v[i].ind;
      lq = inputf[ind].x + s.x * t[ind];
      rq = inputf[ind].x + f.x * t[ind];
      int coef = -1;
      if (lq > rq) {
        coef = 1;
        swap(lq, rq);
      }
      if (isEnd) {
        rq++;
      }
      long long cc = getSum();
      anscnt[ind] += cc * coef;
    }
  }
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  cin >> k >> n >> q;
  for (int i = 0; i < k; i++) {
    cin >> wx[i] >> wy[i];
  }
  generatePoly(0, 0, 0);
  poly = getHull(poly);
  for (int i = 0; i < n; i++) {
    cin >> a[i].x >> a[i].y >> acnt[i];
  }
  for (int i = 0; i < q; i++) {
    cin >> inputf[i].x >> inputf[i].y >> t[i];
  }
  int maxInd = 1;
  for (int i = 0; i < poly.size(); i++) {
    if (poly[i].x > poly[maxInd].x) {
      maxInd = i;
    }
  }
  for (int i = 0; i < poly.size(); i++) {
    getCnt(poly[i], poly[(i + 1) % poly.size()],
           (poly[i].x == poly[maxInd].x) ||
               (poly[(i + 1) % poly.size()].x == poly[maxInd].x));
  }
  for (int i = 0; i < q; i++) {
    cout << anscnt[i] << "\n";
  }
  return 0;
}