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;
using ll = long long;
template <class t, class u>
void chmax(t& first, u second) {
  if (first < second) first = second;
}
template <class t, class u>
void chmin(t& first, u second) {
  if (second < first) first = second;
}
template <class t>
using vc = vector<t>;
template <class t>
using vvc = vc<vc<t>>;
using pi = pair<ll, ll>;
using vi = vc<ll>;
template <class t, class u>
ostream& operator<<(ostream& os, const pair<t, u>& p) {
  return os << "{" << p.first << "," << p.second << "}";
}
template <class t>
ostream& operator<<(ostream& os, const vc<t>& v) {
  os << "{";
  for (auto e : v) os << e << ",";
  return os << "}";
}
using uint = unsigned;
using ull = unsigned long long;
template <class t, size_t n>
ostream& operator<<(ostream& os, const array<t, n>& first) {
  return os << vc<t>(first.begin(), first.end());
}
template <ll i, class T>
void print_tuple(ostream&, const T&) {}
template <ll i, class T, class H, class... Args>
void print_tuple(ostream& os, const T& t) {
  if (i) os << ",";
  os << get<i>(t);
  print_tuple<i + 1, T, Args...>(os, t);
}
template <class... Args>
ostream& operator<<(ostream& os, const tuple<Args...>& t) {
  os << "{";
  print_tuple<0, tuple<Args...>, Args...>(os, t);
  return os << "}";
}
template <class t>
void print(t x, ll suc = 1) {
  cout << x;
  if (suc == 1) cout << "\n";
  if (suc == 2) cout << " ";
}
ll read() {
  ll i;
  cin >> i;
  return i;
}
vi readvi(ll n, ll off = 0) {
  vi v(n);
  for (ll i = ll(0); i < ll(n); i++) v[i] = read() + off;
  return v;
}
template <class T>
void print(const vector<T>& v, ll suc = 1) {
  for (ll i = ll(0); i < ll(v.size()); i++)
    print(v[i], i == ll(v.size()) - 1 ? suc : 2);
}
string readString() {
  string s;
  cin >> s;
  return s;
}
template <class T>
T sq(const T& t) {
  return t * t;
}
void yes(bool ex = true) {
  cout << "Yes"
       << "\n";
  if (ex) exit(0);
}
void no(bool ex = true) {
  cout << "No"
       << "\n";
  if (ex) exit(0);
}
void possible(bool ex = true) {
  cout << "Possible"
       << "\n";
  if (ex) exit(0);
}
void impossible(bool ex = true) {
  cout << "Impossible"
       << "\n";
  if (ex) exit(0);
}
constexpr ll ten(ll n) { return n == 0 ? 1 : ten(n - 1) * 10; }
const ll infLL = LLONG_MAX / 3;
const ll inf = infLL;
ll topbit(signed t) { return t == 0 ? -1 : 31 - __builtin_clz(t); }
ll topbit(ll t) { return t == 0 ? -1 : 63 - __builtin_clzll(t); }
ll botbit(signed first) { return first == 0 ? 32 : __builtin_ctz(first); }
ll botbit(ll first) { return first == 0 ? 64 : __builtin_ctzll(first); }
ll popcount(signed t) { return __builtin_popcount(t); }
ll popcount(ll t) { return __builtin_popcountll(t); }
bool ispow2(ll i) { return i && (i & -i) == i; }
ll mask(ll i) { return (ll(1) << i) - 1; }
bool inc(ll first, ll second, ll c) { return first <= second && second <= c; }
template <class t>
void mkuni(vc<t>& v) {
  sort(v.begin(), v.end());
  v.erase(unique(v.begin(), v.end()), v.end());
}
ll rand_int(ll l, ll r) {
  static mt19937_64 gen(chrono::steady_clock::now().time_since_epoch().count());
  return uniform_int_distribution<ll>(l, r)(gen);
}
template <class t>
void myshuffle(vc<t>& first) {
  for (ll i = ll(0); i < ll(ll(first.size())); i++)
    swap(first[i], first[rand_int(0, i)]);
}
template <class t>
ll lwb(const vc<t>& v, const t& first) {
  return lower_bound(v.begin(), v.end(), first) - v.begin();
}
template <class t>
struct BIT {
  vc<t> buf;
  ll s;
  BIT(ll n = 0) { init(n); }
  void init(ll n) { buf.assign(s = n, 0); }
  void add(ll i, t v) {
    for (; i < s; i += (i + 1) & (-i - 1)) buf[i] += v;
  }
  t get(ll i) {
    t res = 0;
    for (; i >= 0; i -= (i + 1) & (-i - 1)) res += buf[i];
    return res;
  }
  t sum(ll second, ll e) { return get(e - 1) - get(second - 1); }
  ll kth(ll k) {
    ll res = 0;
    for (ll i = topbit(s); i >= 0; i--) {
      ll w = res + (1 << i);
      if (w <= s && buf[w - 1] <= k) {
        k -= buf[w - 1];
        res = w;
      }
    }
    return res;
  }
  ll kth_helper(ll k, ll i) { return kth(k + get(i - 1)); }
};
struct point2d {
  struct query {
    ll x, i, y;
    bool operator<(const query& rhs) const {
      return pi(x, -i) < pi(rhs.x, -rhs.i);
    }
  };
  vi ys, ans;
  vc<query> qs;
  point2d(const vc<tuple<ll, ll, ll>>& ps) {
    for (auto p : ps) {
      ll x, y, c;
      tie(x, y, c) = p;
      if (c) ys.push_back(y);
    }
    mkuni(ys);
    for (auto p : ps) {
      ll x, y, c;
      tie(x, y, c) = p;
      if (c) qs.push_back({x, -c, lwb(ys, y)});
    }
  }
  void aq(ll x, ll y) {
    ll i = ll(ans.size());
    ans.push_back(0);
    y = lwb(ys, y);
    qs.push_back({x, i, y - 1});
  }
  vi calc() {
    sort(qs.begin(), qs.end());
    BIT<ll> bit(ll(ys.size()));
    for (auto q : qs) {
      if (q.i < 0) {
        bit.add(q.y, -q.i);
      } else {
        ans[q.i] += bit.get(q.y);
      }
    }
    return ans;
  }
};
using ld = ll;
using cm = complex<ld>;
const ld eps = 1e-12;
ll sgn(ld first) { return first < -eps ? -1 : (first > eps ? 1 : 0); }
ld rabs(cm first) { return max(abs(first.real()), abs(first.imag())); }
ld signed_rabs(cm first) {
  if (abs(first.real()) > abs(first.imag()))
    return first.real();
  else
    return first.imag();
}
ld dot(cm first, cm second) {
  return first.real() * second.real() + first.imag() * second.imag();
}
ld crs(cm first, cm second) {
  return first.real() * second.imag() - first.imag() * second.real();
}
ld crs(cm first, cm second, cm c) { return crs(second - first, c - first); }
ll ccw(cm first, cm second) { return sgn(crs(first, second)); }
ll ccw(cm first, cm second, cm c) { return ccw(second - first, c - first); }
auto cmless = [](cm first, cm second) {
  ll s = sgn(first.real() - second.real());
  if (s)
    return s < 0;
  else
    return sgn(first.imag() - second.imag()) < 0;
};
bool cmeq(cm first, cm second) {
  return sgn(first.real() - second.real()) == 0 &&
         sgn(first.imag() - second.imag()) == 0;
};
ll argtype(cm first) {
  if (sgn(first.imag()) == 0) return first.real() < 0 ? 1 : 0;
  return first.imag() < 0 ? 0 : 1;
}
ll argcmp(cm first, cm second) {
  ll at = argtype(first), bt = argtype(second);
  if (at != bt) return at < bt ? -1 : 1;
  return -ccw(first, second);
};
bool argless(cm first, cm second) { return argcmp(first, second) < 0; }
ll bet(cm first, cm second, cm c) {
  cm d = second - first;
  ld e = dot(d, c - first);
  if (sgn(e) <= 0) return sgn(e) - 1;
  return sgn(e - norm(d)) + 1;
}
ll cont(cm first, cm second, cm c, cm d) {
  if (ccw(first, second, c) == -1) swap(second, c);
  return min({ccw(first, second, d), ccw(second, c, d), ccw(c, first, d)}) + 1;
}
cm rot90(cm first) { return cm(-first.imag(), first.real()); }
ll gcd(ll first, ll second) {
  return second ? gcd(second, first % second) : first;
}
cm normdir(cm first) {
  if (first == cm(0, 0)) return first;
  ll g = gcd(abs(first.real()), abs(first.imag()));
  return cm(first.real() / g, first.imag() / g);
}
signed main() {
  cin.tie(0);
  ios::sync_with_stdio(0);
  cout << fixed << setprecision(20);
  ll k, n, q;
  cin >> k >> n >> q;
  vc<cm> cv;
  {
    vc<cm> ps;
    for (ll i = ll(0); i < ll(k); i++) {
      ll first, second;
      cin >> first >> second;
      ps.emplace_back(first, second);
      ps.emplace_back(-first, -second);
    }
    sort(ps.begin(), ps.end(), argless);
    cm z;
    for (ll i = ll(k); i < ll(2 * k); i++) z += ps[i];
    for (ll i = ll(0); i < ll(k * 2); i++) {
      cv.push_back(z);
      z += ps[i] * 2LL;
    }
  }
  vc<tuple<ll, ll, ll>> fs;
  ll tot = 0;
  for (ll i = ll(0); i < ll(n); i++) {
    ll first, second, c;
    cin >> first >> second >> c;
    fs.emplace_back(first, second, c);
    tot += c;
  }
  vc<tuple<ll, ll, ll>> qs;
  for (ll i = ll(0); i < ll(q); i++) {
    ll first, second, c;
    cin >> first >> second >> c;
    qs.emplace_back(first, second, c);
  }
  vi ans(q, tot);
  for (ll pos = ll(0); pos < ll(2 * k); pos++) {
    cm d = cv[pos], e = cv[(pos + 1) % (2 * k)], f = e - d;
    {
      cm g = rot90(d), h = rot90(f);
      vc<tuple<ll, ll, ll>> rw;
      for (ll i = ll(0); i < ll(n); i++) {
        ll first, second, c;
        tie(first, second, c) = fs[i];
        rw.emplace_back(dot(cm(first, second), g), dot(cm(first, second), h),
                        c);
      }
      point2d w(rw);
      for (ll i = ll(0); i < ll(q); i++) {
        ll first, second, t;
        tie(first, second, t) = qs[i];
        cm z = cm(first, second) + d * t;
        w.aq(dot(z, g), dot(z, h));
      }
      vi tmp = w.calc();
      for (ll i = ll(0); i < ll(q); i++) ans[i] += tmp[i];
    }
    {
      cm g = rot90(e), h = rot90(f);
      vc<tuple<ll, ll, ll>> rw;
      for (ll i = ll(0); i < ll(n); i++) {
        ll first, second, c;
        tie(first, second, c) = fs[i];
        rw.emplace_back(dot(cm(first, second), g), dot(cm(first, second), h),
                        c);
      }
      point2d w(rw);
      for (ll i = ll(0); i < ll(q); i++) {
        ll first, second, t;
        tie(first, second, t) = qs[i];
        cm z = cm(first, second) + e * t;
        w.aq(dot(z, g), dot(z, h));
      }
      vi tmp = w.calc();
      for (ll i = ll(0); i < ll(q); i++) ans[i] -= tmp[i];
    }
  }
  for (auto v : ans) print(v);
}