#include <iostream>
#include <cmath>
#include <iomanip>
using namespace std;
long double eps = 0.000000001;
int k, n, q;

struct p{
    long double w[11];
    void print () {
        for ( int i = 0 ; i < k ; i ++ ) {
            cout << w[i] << ", ";
        }
        cout << "\n";
    }
};
long double wx[16], wy[16], maxL[16];

p f[(1<<20)], cev;
int a[(1<<20)];

struct v {
    p crr, maxC, minC;
    int l, r, par;
    long long sum, cx;

    v () {
        l = 0;
        r = 0;
        par = 0;
        sum = 0;
        for ( int i = 0 ; i < k ; i ++ ) {
            maxC.w[i] = -1LL<<32;
            minC.w[i] = 1LL<<32;
        }
    }

}tr[(1<<18)];

int sz = 1, root = 0;

int add ( int cV, p &c, int x, int d ) {
    if ( cV == 0 ) {
        tr[sz].crr = c;
        tr[sz].sum = x;
        tr[sz].cx = x;
        tr[sz].minC = c;
        tr[sz].maxC = c;

        return sz ++;
    }
    tr[cV].sum += x;
    for ( int i = 0 ; i < k ; i ++ ) {
        tr[cV].minC.w[i] = min( tr[cV].minC.w[i], c.w[i] );
        tr[cV].maxC.w[i] = max( tr[cV].maxC.w[i], c.w[i] );
    }
    long double cw = c.w[ d%k ], nw = tr[cV].crr.w[d%k];

    if ( cw <= nw ) {
        tr[cV].l = add ( tr[cV].l, c, x, d+1 );
        tr[ tr[cV].l ].par = cV;
    }else {
        tr[cV].r = add ( tr[cV].r, c, x, d+1 );
        tr[ tr[cV].r ].par = cV;
    }
    return cV;
}
bool oktoget( int cv, p &cp, double t ) {
    for ( int i = 0 ; i < k ; i ++ ) {
        if ( cp.w[i] -maxL[i]*t <= eps + tr[cv].minC.w[i] && tr[cv].maxC.w[i]-eps <= cp.w[i]+maxL[i]*t ) {}
        else { return 0; }
    }
    return 1;
}
bool isin ( p a, p b, long double t ) {
    for ( int i = 0 ; i < k ; i ++ ) {
        if ( b.w[i] -maxL[i]*t <= eps + a.w[i] && a.w[i]-eps <= b.w[i]+maxL[i]*t ) {}
        else { return 0; }
    }
    return 1;
}

long long getSum ( int cV, p &c, int d,long double t) {
    if ( cV == 0 ) { return 0; }
    if ( oktoget ( cV, c,t  ) ) { return tr[cV].sum; }

    long double s = c.w[ d%k ] - maxL[ d%k ]*t, m = tr[cV].crr.w[ d%k ], f =  c.w[ d%k ] + maxL[ d%k ]*t;

    int ret = 0;
    if ( isin ( tr[cV].crr, c, t ) ) { ret += tr[cV].cx; }
    if ( s <= eps + m ) { ret += getSum ( tr[cV].l, c, d+1, t ); }
    if ( m-eps <= f ) { ret += getSum ( tr[cV].r, c, d+1, t ); }

    return ret;
}

long double cross ( long double x1, long double y1, long double x2, long double y2 ) {
    return x1*y2 - x2*y1;
}
long double crossS ( long double x1, long double y1, long double x2, long double y2 ) {
    long double ret = cross( x1, y1, x2, y2 );
    if ( ret < -eps ) { return -1; }
    if ( ret > eps ) { return 1; }
    return 0;
}
long double len ( long double x, long double y ) {
    return sqrt ( x*x + y*y );
}
long double getDist ( long double dx, long double dy, long double x, long double y ){
    long double dxP = -dy/len(dx, dy), dyP = dx/len(dx, dy);
    long double l = -(1LL<<32), r = (1LL<<32), ml = l +(r-l)/3, mr = r- (r-l)/3;

    for ( int kk = 0 ; kk < 120 ; kk ++ ) {
        ml = l +(r-l)/3;
        mr = r- (r-l)/3;

//        cout << l << " " << ml << " " << mr << " " << r << "\n";

        if ( abs( cross( x+dxP*ml, y+dyP*ml, dx, dy ) ) < abs( cross( x+dxP*mr, y+dyP*mr, dx, dy ) ) ) {
            r = mr;
        }else {
            l = ml;
        }
    }

    return (l+r)/2;
}
double getMaxL ( double dx, double dy, double sumX, double sumY, int ind ) {
    if ( ind == k ) { return getDist( dx, dy, sumX, sumY ); }
    return max( getMaxL( dx, dy, sumX+wx[ind], sumY+wy[ind], ind+1 ), getMaxL( dx, dy, sumX-wx[ind], sumY-wy[ind], ind+1 ) );
}

void printTr ( int ind ) {
    if ( ind == 0 ) { cout << "<-\n"; return; }
    tr[ind].crr.print();
    printTr ( tr[ind].l );
    printTr ( tr[ind].r );
}

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];
    }
    for ( int i = 0 ; i < k ; i ++ ) {
        maxL[i] = getMaxL( wx[i], wy[i], 0, 0, 0 );
    }

//    for ( int i = 0 ; i < k ; i ++ ) { cout << maxL[i] << " "; } cout << "\n";

    for ( int i = 0 ; i < n ; i ++ ) {

        double x, y;
        cin >> x >> y >> a[i];
        for ( int j = 0 ; j < k ; j ++ ) {
            f[i].w[j] = getDist ( wx[j], wy[j], x, y );
        }

        root = add ( root, f[i], a[i], 0 );
    }

//    printTr ( root );

    for ( int i = 0 ; i < q ; i ++ ) {
        double x, y, t;
        cin >> x >> y >> t;
        for ( int kk = 0 ; kk < k ; kk ++ ) {
            cev.w[kk] = getDist( wx[kk], wy[kk], x, y );
        }
        cout << getSum( root, cev, 0, t ) << "\n";
    }

    return 0;
}


#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
using namespace std;
struct p {
    long long x, y;
    p ( long long x_ = 0 , long long y_ = 0) {
        x = x_;
        y = y_;
    }
};
p operator + ( p a, p b ) {
    return p ( a.x + b.x, a.y + b.y );
}
p operator * ( p a, long long x ) {
    return p ( a.x*x, a.y*x );
}

struct ev {
    long long x, y;
    long long  t, ind, cnt;
    ev ( p c = p() , long long cnt_ = 0, long long t_ = 0, long long ind_ = 0 ) {
        x = c.x;
        y = c.y;
        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);
}

long long  n, k, q;
long long wx[16], wy[16];
vector < p > poly;
p inputf[(1<<20)], a[(1<<20)];
long long anscnt[(1<<20)], acnt[(1<<20)], t[(1<<20)];

struct ver {
    long long  lind, rind, sum;
    ver ( ) {
        lind = -1;
        rind = -1;
        sum = 0;
    }
}it[(1<<22)];
long long sz = 1;

void add ( long long  x, long long  num, long long  l = (-1LL<<32), long long  r = ( 1LL<<32 ), long long  ind = 0 ) {
    if ( l == x && r == x+1 ) {
        it[ind].sum += num;
        return;
    }
    if ( r <= x || x+1 <= l ) { return; }

    if ( it[ind].lind == -1 ) {
        it[sz] = ver();
        it[sz+1] = ver();

        it[ind].lind = sz++;
        it[ind].rind = sz++;
    }

    add( x, num, l, (l+r)/2, it[ind].lind );
    add( x, num, (l+r)/2, r, it[ind].rind );

    it[ind].sum = it[ it[ind].lind ].sum + it[ it[ind].rind ].sum;

}
long long getSum ( long long  l, long long  r, long long  ll = -(1LL<<32), long long  rr = (1LL<<32), long long  ind = 0 ) {
    if ( l <= ll && rr <= r ) { return it[ind].sum; }
    if ( rr <= l || r <= ll ) { return 0; }
    if ( it[ind].lind == -1 ) { return 0; }

    return getSum ( l, r, ll, (ll+rr)/2, it[ind].lind ) + getSum ( l, r, (ll+rr)/2, rr, it[ind].rind );
}

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 );

/*
    cout << chcent.x << " " << chcent.y << "\n";
    cout << "sorted: \n";
    for ( long long i = 0 ; i < pts.size() ; i ++ ) {
        cout << pts[i].x << " " << pts[i].y << "\n";
    }
    cout << "\n";
*/

    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] );
    }

    /*
    cout <<"hull:\n";
    for ( long long i = 0 ; i < ans.size() ; i ++ ) {
        cout << ans[i].x << " " << ans[i].y << "\n";
    }
    */

    return ans;
}
void generatePoly ( long long ind, long long sumX, long long 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] );
}

bool cmpev ( ev a, ev b ) {
    return a.x == b.x ?
        a.t < b.t
            : a.x < b.x;
}
vector < ev > v;
void getCnt ( p s, p f ) {
    if ( s.x == f.x ) { return ; }

    v.clear();

    it[0] = ver();
    sz = 1;

    for ( int i = 0 ; i < q ; i ++ ) {
        v.push_back( ev( inputf[i] + s*t[i], -1, 1, i ) );
        v.push_back( ev( inputf[i] + f*t[i], -1, 2, i ) );
    }
    for ( int i = 0 ; i < n ; i ++ ) {
        v.push_back( ev ( a[i], acnt[i], 0, i ) );
    }

    sort( v.begin(), v.end(), cmpev );

    double slope = (f.y-s.y)/(double)(f.x-s.x);

    for ( int i = 0 ; i < v.size() ; i ++ ) {
//        cout << "going for " << v[i].x << " " << v[i].y << "\n";

        if ( v[i].t == 0 ) {
            add ( floor ( v[i].y - v[i].x*slope ), v[i].cnt );
        }else {
            long long cc = getSum( -(1LL<<32), floor ( v[i].y - v[i].x*slope ) );
            if ( v[i].t == 1 ) { anscnt[ v[i].ind ] -= cc; }
            else { anscnt[ v[i].ind ] += cc; }
        }

    }

}

int main () {
    ios::sync_with_stdio(false);
    cin.tie(NULL);

    cin >> k >> n >> q;
    for ( long long  i = 0 ; i < k ; i ++ ) {
        cin >> wx[i] >> wy[i];
    }
    generatePoly( 0, 0, 0 );
    poly = getHull( poly );

/*
    cout << "poly:\n";
    for ( long long i = 0 ; i < poly.size() ; i ++ ) {
        cout << poly[i].x << " " << poly[i].y << "\n";
    }
    cout << "\n";
*/

    for ( long long  i = 0 ; i < n ; i ++ ) {
        cin >> a[i].x >> a[i].y >> acnt[i];
    }
    for ( long long  i = 0 ; i < q ; i ++ ) {
        cin >> inputf[i].x >> inputf[i].y >> t[i];
    }

    for ( long long  i = 0 ; i < poly.size() ; i ++ ) {
        getCnt( poly[i], poly[( i+1 )%poly.size() ] );
    }
    for ( long long  i = 0 ; i < q ; i ++ ) {
        cout << -anscnt[i] << "\n";
    }
    return 0;
}


#include <bits/stdc++.h>

using namespace std;
typedef long long INT;
typedef pair<int, int> pii;
typedef pair<INT, INT> PII;

#define mp make_pair
#define x first
#define y second

pii operator + (const pii &a, const pii &b) {return mp(a.x+b.x, a.y+b.y);}
pii operator - (const pii &a, const pii &b) {return mp(a.x-b.x, a.y-b.y);}
INT operator ^ (const pii &a, const pii &b) {return (INT)a.x*b.y-(INT)a.y*b.x;}
pii operator * (const pii &a, const int &x) {return mp(a.x*x, a.y*x);}

#define NN 200200

pii P[NN], Q[NN], A[NN], C[NN];
PII d[NN], e[NN];
INT x[NN], y[NN], B[NN], ans[NN];
int a[NN], c[NN], nx, ny, I[NN], J[NN];

PII trans(const pii &a, const pii &O, const pii &X, const pii &Y) {return mp(a-O^Y, X^a-O);}
void update(int u, int x) {for (; u<=ny; u+=u&-u) B[u]+=x;}
INT calc(int u, INT ans=0) {for (; u; u^=u&-u) ans+=B[u];return ans;}

void solve(int n, int q, pii O, pii X, pii Y) {
	nx=ny=0;
	for (int i=0; i<n; i++) {
		d[i] = trans(A[i], O, X, Y);
		x[nx++]=d[i].x; y[ny++]=d[i].y;
		I[i]=i;
	}
	for (int i=0; i<q; i++) {
		e[i] = trans(C[i]+O*c[i], O, X, Y);
		x[nx++]=e[i].x, y[ny++]=e[i].y;
		J[i]=i;
	}
	sort(x, x+nx); nx=unique(x, x+nx)-x;
	sort(y, y+ny); ny=unique(y, y+ny)-y;
	sort(I, I+n, [&](int u, int v){return d[u]<d[v];});
	sort(J, J+q, [&](int u, int v){return e[u]<e[v];});
	for (int i=0; i<=ny; i++) B[i]=0;
	for (int j=0, i=0; j<q; j++) {
		int u=J[j];
		while (i<n && d[I[i]].x<=e[u].x) update(upper_bound(y, y+ny, d[I[i]].y)-y, a[I[i]]), i++;
		ans[u] += calc(lower_bound(y, y+ny, e[u].y)-y);
	}
}

int convex_hull(pii *p, int n, pii *q) {
	sort(p, p+n);
	n=unique(p, p+n)-p;
	int m=0;
	for (int i=0; i<n; i++) {
		while (m>1 && (q[m-2]-q[m-1]^p[i]-q[m-1])>=0) m--;
		q[m++]=p[i];
	}
	for (int i=n-2, t=m; i>=0; i--) {
		while (m>t && (q[m-2]-q[m-1]^p[i]-q[m-1])>=0) m--;
		q[m++]=p[i];
	}
	return m-(m>3);
}

int main() {
#ifndef ONLINE_JUDGE
	freopen("in.in", "r", stdin);
	freopen("out.out", "w", stdout);
#endif

	int k, n, q, x, y, m;
	cin>>k>>n>>q;
	P[0]=pii(0, 0); m=1;
	for (int i=0; i<k; i++) {
		scanf("%d%d", &x, &y);
		pii R = mp(x, y);
		for (int j=0; j<m; j++) Q[j]=P[j]-R, Q[j+m]=P[j]+R;
		m=convex_hull(Q, m<<1, P);
	}

	INT sum=0;
	for (int i=0; i<n; i++) scanf("%d%d%d", &A[i].x, &A[i].y, a+i), sum+=a[i];
	for (int i=0; i<q; i++) scanf("%d%d%d", &C[i].x, &C[i].y, c+i);

	for (int i=0; i<m; i++) solve(n, q, P[i], P[i]-P[(i+m-1)%m], P[(i+1)%m]-P[i]);

	for (int i=0; i<q; i++) printf("%I64d\n", sum - ans[i]);
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
using LL = long long;
using point = struct Point {
  LL x, y;
  Point(LL x=0, LL y=0): x(x), y(y){}
  void in(){scanf("%I64d%I64d",&x,&y);}
  void pr(){cout<<x<<' '<<y<<endl;}
};
using posit = struct Position {
  int x, y, id;
  Position(int x=0, int y=0, int id=0): x(x), y(y), id(id){}
  void pr() { cout<<x<<' '<<y<<' '<<id<<endl; }
};

point operator+(const point&a,const point&b){return{a.x+b.x,a.y+b.y};}
point operator-(const point&a,const point&b){return{a.x-b.x,a.y-b.y};}
point operator*(const point&a,const int& b){return {a.x*b,a.y*b};}
LL    operator*(const point&a,const point&b){return a.x*b.x+a.y*b.y;}
LL    operator^(const point&a,const point&b){return a.x*b.y-a.y*b.x;}
bool  operator<(const point&a,const point&b){return a.x==b.x?a.y<b.y:a.x<b.x;}
int sgn(int a){return (a>0ll)-(a<0ll);}
bool  operator<(const posit&a,const posit&b){
  if(a.y!=b.y) return a.y>b.y;
  if(sgn(a.id)!=sgn(b.id)) return a.id>b.id;
  return a.x<b.x;
}

const int NN = 1e5+10;
point a[NN], b[NN], c[1000], d[1000], e[1000];
point g[NN], h[NN];
int car[NN], days[NN];
LL x[NN<<1], y[NN<<1], B[NN<<1], ans[NN];
int nx, ny;
posit p[NN<<1];

int sgn(LL a){return (a>0ll)-(a<0ll);}
point change(point p, point a, point b) {
  return point((p.x*b.y-b.x*p.y)*sgn(a.x*b.y-a.y*b.x), (a.x*p.y-p.x*a.y)*sgn(a.x*b.y-a.y*b.x));
}

int main() {
#ifndef ONLINE_JUDGE
  freopen("in.in", "r", stdin);
  freopen("out.out", "w", stdout);
#endif
  LL tot=0;
  int nn, m, q, n=1;
  scanf("%d %d %d", &nn, &m, &q);
  for(int i=0; i<nn; i++) e[i].in();
  for(int i=0; i<m; i++) a[i].in(), scanf("%d", car+i), tot+=car[i];
  for(int i=0; i<q; i++) b[i].in(), scanf("%d", days+i), ans[i+1]=tot;

  for(int g=0; g<nn; g++) {
    for(int i=0; i<n; i++) {
      d[i+n]=c[i]-e[g];
      d[i]=c[i]+e[g];
    }
    n<<=1;
    sort(d, d+n);
    int m=0;
    for(int i=0; i<n; i++) {
      for(; m>1&&(d[i]-c[m-2]^c[m-1]-c[m-2])>=0ll; m--);
      c[m++]=d[i];
    }
    for(int i=n-1, j=m; i--; ) {
      for(; m>j&&(d[i]-c[m-2]^c[m-1]-c[m-2])>=0ll; m--);
      c[m++]=d[i];
    }
    n=m-1;
  }
  c[n+1]=c[1];

  for(int F=0; F<n; F++) {
    for(int i=nx=ny=0; i<m; i++) {
      g[i]=change(a[i], c[F+2]-c[F+1], c[F+1]-c[F]);
      x[nx++]=g[i].x;
      y[ny++]=g[i].y;
      p[i].id=-car[i];
    }
    for(int i=0; i<q; i++) {
      h[i]=change(b[i]+c[F+1]*days[i], c[F+2]-c[F+1], c[F+1]-c[F]);
      x[nx++]=h[i].x;
      y[ny++]=h[i].y;
      p[i+m].id=i+1;
    }

    sort(x, x+nx); nx=unique(x, x+nx)-x;
    sort(y, y+ny); ny=unique(y, y+ny)-y;
    for(int i=0; i<m; i++) {
      p[i].x=lower_bound(x, x+nx, g[i].x)-x+1;
      p[i].y=lower_bound(y, y+ny, g[i].y)-y+1;
    }
    for(int i=0; i<q; i++) {
      p[i+m].x=lower_bound(x, x+nx, h[i].x)-x+1;
      p[i+m].y=lower_bound(y, y+ny, h[i].y)-y+1;
    }
    sort(p, p+m+q);
    for(int i=1; i<=nx; i++) B[i]=0;
    for(int i=0; i<m+q; i++) {
      if(p[i].id>0) {
        LL t=0;
        for(int u=p[i].x; u<=nx; u+=u&-u) t+=B[u];
        ans[p[i].id]-=t;
      }else {
        LL t=-p[i].id;
        for(int u=p[i].x; u>0; u-=u&-u) B[u]+=t;
      }
    }
  }
  for(int i=1; i<=q; i++) printf("%I64d\n", ans[i]);
  return 0;
}


#include <iostream>
#include <algorithm>
#include <cstring>
#define MAXN 100010
#define MAXK 10

using namespace std;

struct point {
    long long x,y;
    point() {}
    point(long long x, long long y) : x(x), y(y) {}

    point operator + (point p) { return point(x+p.x, y+p.y); }
    point operator - (point p) { return point(x-p.x, y-p.y); }
    point operator * (long long a) { return point(a*x, a*y); }

    bool operator < (point p) const {
        if (x != p.x) return x < p.x;
        return y < p.y;
    }
    bool operator == (point p) const {
        return x == p.x && y == p.y;
    }
};

long long cross(point a, point b) {
    return a.x * b.y - a.y * b.x;
}

int k,n,q;
point v[MAXK],f[MAXN],p[MAXN];
int a[MAXN],t[MAXN];
long long ans[MAXN];

vector<point> m_points;

void gen_points(int i, point x) {
    if (i == k) {
        m_points.push_back(x);
        return;
    }
    gen_points(i + 1, x + v[i]);
    gen_points(i + 1, x - v[i]);
}

vector<point> uh, lh;
void minkowski() {
    gen_points(0, point(0, 0));
    sort(m_points.begin(), m_points.end());
    m_points.erase(unique(m_points.begin(), m_points.end()), m_points.end());

    for (point &p : m_points) {
        while (uh.size() > 1) {
            point a = uh[uh.size()-2], b = uh.back();
            if (cross(p-a,b-a) > 0) break;
            uh.pop_back();
        }
        uh.push_back(p);
    }

    for (point &p : m_points) {
        while (lh.size() > 1) {
            point a = lh[lh.size()-2], b = lh.back();
            if (cross(b-a,p-a) > 0) break;
            lh.pop_back();
        }
        lh.push_back(p);
    }
}

struct event {
    long long y;
    int op, i;
    event(long long y, int op, int i) : y(y), op(op), i(i) {};

    bool operator < (const event& e) const {
        if (y != e.y) return y < e.y;
        return op < e.op;
    }
};

long long num[MAXN];
long long l[MAXN],r[MAXN],x[MAXN];
long long bit[3*MAXN];

void add(int x, long long val) {
    for (; x < 3*MAXN; x += x & -x) bit[x] += val;
}

long long get(int x) {
    long long res = 0;
    for (; x > 0; x -= x & -x) res += bit[x];
    return res;
}

void go(point u, point v, bool incr, bool inctop) {
    point e = v - u;
    vector<event> events;
    vector<long long> cx;
    for (int i = 0; i < q; i++) {
        long long y = cross(e, p[i] + u * t[i]);
        if (e.x == 0) {
            if (inctop) y = p[i].y + t[i] * max(u.y, v.y);
            else y = p[i].y + t[i] * min(u.y, v.y) - 1;
        } else if (!inctop) y--;
        events.push_back(event(y, 1, i));
        l[i] = p[i].x + t[i] * u.x;
        r[i] = p[i].x + t[i] * v.x - 1;
        if (incr) r[i]++;
        cx.push_back(l[i]);
        cx.push_back(r[i]);
    }
    for (int i = 0; i < n; i++) {
        long long y = cross(e, f[i]);
        if (e.x == 0) y = f[i].y;
        events.push_back(event(y, 0, i));
        x[i] = f[i].x;
        cx.push_back(x[i]);
    }

    sort(cx.begin(), cx.end());
    cx.erase(unique(cx.begin(), cx.end()), cx.end());
    for (int i = 0; i < q; i++) {
        l[i] = upper_bound(cx.begin(), cx.end(), l[i]) - cx.begin();
        r[i] = upper_bound(cx.begin(), cx.end(), r[i]) - cx.begin();
    }
    for (int i = 0 ; i < n; i++) {
        x[i] = upper_bound(cx.begin(), cx.end(), x[i]) - cx.begin();
    }

    memset(bit,0,sizeof(bit));
    sort(events.begin(), events.end());
    for (auto &ev : events) {
        int i = ev.i;
        if (ev.op == 1) {
            num[i] = get(r[i]) - get(l[i] - 1);
        } else {
            add(x[i], a[i]);
        }
    }
}

int main() {
    ios::sync_with_stdio(0);
    cin >> k >> n >> q;
    for (int i = 0; i < k; i++) {
        cin >> v[i].x >> v[i].y;
    }

    for (int i = 0; i < n; i++) {
        cin >> f[i].x >> f[i].y >> a[i];
    }

    for (int i = 0; i < q; i++) {
        cin >> p[i].x >> p[i].y >> t[i];
    }

    minkowski();

    for (int i = 0; i + 1 < uh.size(); i++) {
        go(uh[i], uh[i + 1], i + 2 == uh.size(), 1);
        //cerr << uh[i].x << "," << uh[i].y << " -> " << uh[i+1].x << "," << uh[i+1].y << endl;
        for (int j = 0; j < q; j++) {
            ans[j] += num[j];
            //cerr << num[j] << endl;
        }
    }
    for (int i = 0; i + 1 < lh.size(); i++) {
        go(lh[i], lh[i + 1], i + 2 == lh.size(), 0);
        //cerr << lh[i].x << "," << lh[i].y << " -> " << lh[i+1].x << "," << lh[i+1].y << endl;
        for (int j = 0; j < q; j++) {
            ans[j] -= num[j];
            //cerr << -num[j] << endl;
        }
    }

    for (int i = 0; i < q; i++) {
        cout << ans[i] << '\n';
    }
}


#include<iostream>
#include<vector>
#include<algorithm>
#include<cstring>
#include<cstdio>
#include<cmath>
#include<cstdlib>
#include<ctime>
#include<queue>
#include<set>
#include<map>
#include<stack>
using namespace std;
typedef long long LL;
const int N=2e5;
int gi() {
	int w=0;bool q=1;char c=getchar();
	while ((c<'0'||c>'9') && c!='-') c=getchar();
	if (c=='-') q=0,c=getchar();
	while (c>='0'&&c <= '9') w=w*10+c-'0',c=getchar();
	return q? w:-w;
}
struct P{ int x,y; inline void in() { x=gi(),y=gi(); } };
inline P operator + (const P &a,const P &b) { return (P){a.x+b.x,a.y+b.y}; }
inline P operator - (const P &a,const P &b) { return (P){a.x-b.x,a.y-b.y}; }
inline LL operator * (const P &a,const P &b) { return 1LL*a.x*b.y-1LL*a.y*b.x; }
inline LL dot(const P &a,const P &b) { return 1LL*a.x*b.x+1LL*a.y*b.y; }
inline bool operator < (const P &a,const P &b) { return a*b>0; }
#define ps(x) (upper_bound(c+1,c+cn+1,x)-c-1)
P v[100],p[N],q[N],cur[N];
int w[N],lim[N],c[N];
struct work{
	double a; int x,y,z;
	inline bool operator < (const work &b) const {
		return fabs(a-b.a)<1e-7?z<b.z:a<b.a;
	}
}T[N*3];
LL s[N],ans[N];
inline void add(int k,int x) { for (;k<=1e5;k+=k&-k) s[k]+=x; }
inline LL sum(int k) {
	LL ans=0;
	for (;k;k^=k&-k) ans+=s[k];
	return ans;
}
int main()
{
#ifndef ONLINE_JUDGE
	freopen("CF853E.in","r",stdin);
	freopen("CF853E.out","w",stdout);
#endif
	int n=gi(),m=gi(),Q=gi(),i,j,cn;P all=(P){0,0};
	for (i=1;i<=n;i++) {
		v[i].in();
		if (v[i].x<0||(v[i].x==0&&v[i].y<0)) v[i].x*=-1,v[i].y*=-1;
		all=all+v[i];
	}
	sort(v+1,v+1+n);
	for (i=1;i<=m;i++) p[i].in(),w[i]=gi(),c[i]=p[i].x;
	sort(c+1,c+1+m);cn=unique(c+1,c+1+m)-c-1;
	for (i=1;i<=Q;i++) {
		q[i].in(),cur[i]=q[i],lim[i]=gi();
		q[i].x-=all.x*lim[i],q[i].y-=all.y*lim[i];
		lim[i]<<=1;
	}
	for (i=1;i<=n;i++) {
		if (!v[i].x) {
			for (j=1;j<=Q;j++) q[j].y+=v[i].y*lim[j];
			continue;
		}
		for (j=1;j<=m;j++)
			T[j]=(work){p[j].y-(double)p[j].x*v[i].y/v[i].x,p[j].x,w[j],0};
		for (j=1;j<=Q;j++) {
			T[m+j]=(work){q[j].y-(double)q[j].x*v[i].y/v[i].x,q[j].x,q[j].x+v[i].x*lim[j],-j};
			q[j].x+=v[i].x*lim[j],q[j].y+=v[i].y*lim[j];
		}
		memset(s,0,sizeof(s));
		sort(T+1,T+1+m+Q);
		for (j=1;j<=m+Q;j++)
			if (T[j].z)
				ans[-T[j].z]-=sum(ps(T[j].y))-sum(ps(T[j].x-(i<2)));
			else add(ps(T[j].x),T[j].y);
	}
	for (i=1;i<=n;i++) {
		if (!v[i].x) break;
		for (j=1;j<=m;j++)
			T[j]=(work){p[j].y-(double)p[j].x*v[i].y/v[i].x,p[j].x,w[j],0};
		for (j=1;j<=Q;j++) {
			T[m+j]=(work){q[j].y-(double)q[j].x*v[i].y/v[i].x,q[j].x-v[i].x*lim[j],q[j].x,j};
			q[j].x-=v[i].x*lim[j],q[j].y-=v[i].y*lim[j];
		}
		memset(s,0,sizeof(s));
		sort(T+1,T+1+m+Q);
		for (j=1;j<=m+Q;j++)
			if (T[j].z)
				ans[T[j].z]+=sum(ps(T[j].y-(i>1)))-sum(ps(T[j].x-1));
			else add(ps(T[j].x),T[j].y);
	}
	for (i=1;i<=Q;i++) printf("%I64d\n",ans[i]);
	return 0;
}


#include<bits/stdc++.h>
using namespace std;

typedef double DB;
const DB PI = acos(DB(-1));
const DB INF = 1e10;
const DB EPS = 1e-8;

inline DB sqr(DB x) {
	return x * x;
}

struct PT {
	DB x, y;

	PT() {}
	PT(DB x, DB y) : x(x), y(y) {}
	void in() {
		scanf("%lf%lf", &x, &y);
	}
};

bool operator<(const PT& p1, const PT& p2) {
	if (fabs(p1.x - p2.x) > EPS) return p1.x < p2.x;
	return p1.y + EPS < p2.y;
}

bool operator==(const PT& p1, const PT& p2) {
	return fabs(p1.x - p2.x) < EPS && fabs(p1.y - p2.y) < EPS;
}

PT operator+(PT p1, PT p2) {
	return PT(p1.x + p2.x, p1.y + p2.y);
}

PT operator-(PT p1, PT p2) {
	return PT(p1.x - p2.x, p1.y - p2.y);
}

PT operator*(PT p, DB c) {
	return PT(p.x * c, p.y * c);
}

PT operator/(PT p, DB c) {
	return PT(p.x / c, p.y / c);
}

DB vect(PT p1, PT p2) {
	return p1.x * p2.y - p2.x * p1.y;
}

DB vect(PT p, PT p1, PT p2) {
	return vect(p1 - p, p2 - p);
}

int convex_hull(PT *p, int n, PT *q) {
	sort(p, p + n);
	n = unique(p, p + n) - p;
	if (n == 1) {
		q[0] = p[0];
		return 1;
	}
	int m = 0;
	for (int i = 0; i < n; i++) {
		while (m > 1 && vect(q[m - 2], q[m - 1], p[i]) < EPS) m--;
		q[m++] = p[i];
	}
	int k = m;
	for (int i = n - 2; i >= 0; i--) {
		while (m > k && vect(q[m - 2], q[m - 1], p[i]) < EPS) m--;
		q[m++] = p[i];
	}
	return --m;
}

struct query{
	int qid, x, y, sig;
	query(int qid = 0, int x = 0, int y = 0, int sig = 1) : qid(qid), x(x), y(y), sig(sig) {}
	bool operator < (const query &q) const {
		if (x == q.x) return y < q.y;
		return x < q.x;
	}
};

struct data{
	int x, y, val;
	data(int x = 0, int y = 0, int val = 0) : x(x), y(y), val(val) {}
	bool operator < (const data &d) const {
		if (x == d.x) return y < d.y;
		return x < d.x;
	}
};

const int N = 110000;
const int M = 40;
PT V[M], P[M], Q[M], F[N], R[N][M], DX[M], DY[M];;
int a[N];
long long b[N];
long long ans[N];
vector<DB> VX[M], VY[M];
vector<data> D[M];
vector<query> QR[M];

PT trans(PT P, PT O, PT X, PT Y) {
	return PT(((P.x - O.x) * Y.y - (P.y - O.y) * Y.x) / (X.x * Y.y - X.y * Y.x), ((P.x - O.x) * X.y - (P.y - O.y) * X.x) / (X.y * Y.x - X.x * Y.y));
}

void add(int x, int y) {
	for (x += 2; x < N; x += x & -x) b[x] += y;
}

long long get(int x) {
	long long ret = 0;
	for (x += 2; x; x -= x & -x) ret += b[x];
	return ret;
}

int main() {
//	freopen("in.txt", "r", stdin);
	int k, n, q; scanf("%d%d%d", &k, &n, &q);
	int m = 1;
	P[0] = PT(0, 0);
	for (int i = 0; i < k; i++) {
		V[i].in();
		for (int j = 0; j < m; j++) Q[j] = P[j] - V[i], Q[j + m] = P[j] + V[i];
		m = convex_hull(Q, m + m, P);
	}
	long long sum = 0;
	for (int i = 0; i < n; i++) {
		F[i].in(); scanf("%d", &a[i]);
		sum += a[i];
		for (int j = 0; j < m; j++) {
			DX[j] = P[j] - P[(j - 1 + m) % m];
			DY[j] = P[(j + 1) % m] - P[j];
			R[i][j] = trans(F[i], P[j], DX[j], DY[j]);
			VX[j].push_back(R[i][j].x);
			VY[j].push_back(R[i][j].y);
		}
	}
	for (int j = 0; j < m; j++) {
		sort(VX[j].begin(), VX[j].end());
		sort(VY[j].begin(), VY[j].end());
	}
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < m; j++) {
			int x = lower_bound(VX[j].begin(), VX[j].end(), R[i][j].x - EPS) - VX[j].begin();
			int y = lower_bound(VY[j].begin(), VY[j].end(), R[i][j].y - EPS) - VY[j].begin();
			D[j].push_back(data(x, y, a[i]));
		}
	}
	for (int i = 0; i < m; i++) sort(D[i].begin(), D[i].end());
	for (int i = 0; i < q; i++) {
		PT S; S.in(); DB t; scanf("%lf", &t);
		for (int j = 0; j < m; j++) {
			PT ret = trans(S + P[j] * t, P[j], DX[j], DY[j]);
			int x = upper_bound(VX[j].begin(), VX[j].end(), ret.x + EPS) - VX[j].begin() - 1;
			int y = lower_bound(VY[j].begin(), VY[j].end(), ret.y - EPS) - VY[j].begin() - 1;
			QR[j].push_back(query(i, x, y, -1));
		}
	}
	for (int i = 0; i < m; i++) sort(QR[i].begin(), QR[i].end());
	for (int i = 0; i < m; i++) {
		int dn = 0, qn = 0;
		memset(b, 0, sizeof b);
		for (int j = -1; j < N; j++) {
			vector<pair<int, long long>> vec;
			long long cur = 0;
			while (dn < D[i].size() && D[i][dn].x == j) {
				add(D[i][dn].y, D[i][dn].val);
				vec.push_back(make_pair(D[i][dn].y, cur));
				cur += D[i][dn].val;
				++dn;
			}
			while (qn < QR[i].size() && QR[i][qn].x == j) {
				ans[QR[i][qn].qid] -= get(QR[i][qn].y);
				++qn;
			}
		}
	}
	for (int i = 0; i < q; i++) printf("%lld\n", sum + ans[i]);
}


#include<bits/stdc++.h>
using namespace std;

typedef long double DB;
const DB PI = acos(DB(-1));
const DB INF = 1e10;
const DB EPS = 1e-10;

inline DB sqr(DB x) {
	return x * x;
}

struct PT {
	DB x, y;

	PT() {}
	PT(DB x, DB y) : x(x), y(y) {}
	void in() {
		double _x, _y;
		scanf("%lf%lf", &_x, &_y);
		x = _x, y = _y;
	}
};

bool operator<(const PT& p1, const PT& p2) {
	if (fabs(p1.x - p2.x) > EPS) return p1.x < p2.x;
	return p1.y + EPS < p2.y;
}

bool operator==(const PT& p1, const PT& p2) {
	return fabs(p1.x - p2.x) < EPS && fabs(p1.y - p2.y) < EPS;
}

PT operator+(PT p1, PT p2) {
	return PT(p1.x + p2.x, p1.y + p2.y);
}

PT operator-(PT p1, PT p2) {
	return PT(p1.x - p2.x, p1.y - p2.y);
}

PT operator*(PT p, DB c) {
	return PT(p.x * c, p.y * c);
}

PT operator/(PT p, DB c) {
	return PT(p.x / c, p.y / c);
}

DB vect(PT p1, PT p2) {
	return p1.x * p2.y - p2.x * p1.y;
}

DB vect(PT p, PT p1, PT p2) {
	return vect(p1 - p, p2 - p);
}

int convex_hull(PT *p, int n, PT *q) {
	sort(p, p + n);
	n = unique(p, p + n) - p;
	if (n == 1) {
		q[0] = p[0];
		return 1;
	}
	int m = 0;
	for (int i = 0; i < n; i++) {
		while (m > 1 && vect(q[m - 2], q[m - 1], p[i]) < EPS) m--;
		q[m++] = p[i];
	}
	int k = m;
	for (int i = n - 2; i >= 0; i--) {
		while (m > k && vect(q[m - 2], q[m - 1], p[i]) < EPS) m--;
		q[m++] = p[i];
	}
	return --m;
}

struct query{
	int qid, x, y, sig;
	query(int qid = 0, int x = 0, int y = 0, int sig = 1) : qid(qid), x(x), y(y), sig(sig) {}
	bool operator < (const query &q) const {
		if (x == q.x) return y < q.y;
		return x < q.x;
	}
};

struct data{
	int x, y, val;
	data(int x = 0, int y = 0, int val = 0) : x(x), y(y), val(val) {}
	bool operator < (const data &d) const {
		if (x == d.x) return y < d.y;
		return x < d.x;
	}
};

const int N = 110000;
const int M = 40;
PT V[M], P[M], Q[M], F[N], R[N][M], DX[M], DY[M];;
int a[N];
long long b[N];
long long ans[N];
vector<DB> VX[M], VY[M];
vector<data> D[M];
vector<query> QR[M];

PT trans(PT P, PT O, PT X, PT Y) {
	return PT(((P.x - O.x) * Y.y - (P.y - O.y) * Y.x) / (X.x * Y.y - X.y * Y.x), ((P.x - O.x) * X.y - (P.y - O.y) * X.x) / (X.y * Y.x - X.x * Y.y));
}

void add(int x, int y) {
	for (x += 2; x < N; x += x & -x) b[x] += y;
}

long long get(int x) {
	long long ret = 0;
	for (x += 2; x; x -= x & -x) ret += b[x];
	return ret;
}

int main() {
//	freopen("in.txt", "r", stdin);
	int k, n, q; scanf("%d%d%d", &k, &n, &q);
	int m = 1;
	P[0] = PT(0, 0);
	for (int i = 0; i < k; i++) {
		V[i].in();
		for (int j = 0; j < m; j++) Q[j] = P[j] - V[i], Q[j + m] = P[j] + V[i];
		m = convex_hull(Q, m + m, P);
	}
	long long sum = 0;
	for (int i = 0; i < n; i++) {
		F[i].in(); scanf("%d", &a[i]);
		sum += a[i];
		for (int j = 0; j < m; j++) {
			DX[j] = P[j] - P[(j - 1 + m) % m];
			DY[j] = P[(j + 1) % m] - P[j];
			R[i][j] = trans(F[i], P[j], DX[j], DY[j]);
			VX[j].push_back(R[i][j].x);
			VY[j].push_back(R[i][j].y);
		}
	}
	for (int j = 0; j < m; j++) {
		sort(VX[j].begin(), VX[j].end());
		sort(VY[j].begin(), VY[j].end());
	}
	for (int j = 0; j < m; j++) {
		for (int i = 0; i < n; i++) {
			int x = lower_bound(VX[j].begin(), VX[j].end(), R[i][j].x - EPS) - VX[j].begin();
			int y = lower_bound(VY[j].begin(), VY[j].end(), R[i][j].y - EPS) - VY[j].begin();
			D[j].push_back(data(x, y, a[i]));
		}
	}
	for (int i = 0; i < m; i++) sort(D[i].begin(), D[i].end());
	for (int i = 0; i < q; i++) {
		PT S; S.in(); double _t; scanf("%lf", &_t);
		DB t = _t;
		for (int j = 0; j < m; j++) {
			PT ret = trans(S + P[j] * t, P[j], DX[j], DY[j]);
			int x = upper_bound(VX[j].begin(), VX[j].end(), ret.x + EPS) - VX[j].begin() - 1;
			int y = lower_bound(VY[j].begin(), VY[j].end(), ret.y - EPS) - VY[j].begin() - 1;
			QR[j].push_back(query(i, x, y, -1));
		}
	}
	for (int i = 0; i < m; i++) sort(QR[i].begin(), QR[i].end());
	for (int i = 0; i < m; i++) {
		int dn = 0, qn = 0;
		memset(b, 0, sizeof b);
		for (int j = -1; j < N; j++) {
			vector<pair<int, long long>> vec;
			long long cur = 0;
			while (dn < D[i].size() && D[i][dn].x == j) {
				add(D[i][dn].y, D[i][dn].val);
				vec.push_back(make_pair(D[i][dn].y, cur));
				cur += D[i][dn].val;
				++dn;
			}
			while (qn < QR[i].size() && QR[i][qn].x == j) {
				ans[QR[i][qn].qid] -= get(QR[i][qn].y);
				++qn;
			}
		}
	}
	for (int i = 0; i < q; i++) printf("%lld\n", sum + ans[i]);
}


#include<bits/stdc++.h>
using namespace std;

typedef long double DB;
const DB PI = acos(DB(-1));
const DB INF = 1e10;
const DB EPS = 1e-10;

inline DB sqr(DB x) {
	return x * x;
}

struct PT {
	DB x, y;

	PT() {}
	PT(DB x, DB y) : x(x), y(y) {}
	void in() {
		double _x, _y;
		scanf("%lf%lf", &_x, &_y);
		x = _x, y = _y;
	}
};

bool operator<(const PT& p1, const PT& p2) {
	if (fabs(p1.x - p2.x) > EPS) return p1.x < p2.x;
	return p1.y + EPS < p2.y;
}

bool operator==(const PT& p1, const PT& p2) {
	return fabs(p1.x - p2.x) < EPS && fabs(p1.y - p2.y) < EPS;
}

PT operator+(PT p1, PT p2) {
	return PT(p1.x + p2.x, p1.y + p2.y);
}

PT operator-(PT p1, PT p2) {
	return PT(p1.x - p2.x, p1.y - p2.y);
}

PT operator*(PT p, DB c) {
	return PT(p.x * c, p.y * c);
}

PT operator/(PT p, DB c) {
	return PT(p.x / c, p.y / c);
}

DB vect(PT p1, PT p2) {
	return p1.x * p2.y - p2.x * p1.y;
}

DB vect(PT p, PT p1, PT p2) {
	return vect(p1 - p, p2 - p);
}

int convex_hull(PT *p, int n, PT *q) {
	sort(p, p + n);
	n = unique(p, p + n) - p;
	if (n == 1) {
		q[0] = p[0];
		return 1;
	}
	int m = 0;
	for (int i = 0; i < n; i++) {
		while (m > 1 && vect(q[m - 2], q[m - 1], p[i]) < EPS) m--;
		q[m++] = p[i];
	}
	int k = m;
	for (int i = n - 2; i >= 0; i--) {
		while (m > k && vect(q[m - 2], q[m - 1], p[i]) < EPS) m--;
		q[m++] = p[i];
	}
	return --m;
}

struct query{
	int qid, x, y, sig;
	query(int qid = 0, int x = 0, int y = 0, int sig = 1) : qid(qid), x(x), y(y), sig(sig) {}
	bool operator < (const query &q) const {
		if (x == q.x) return y < q.y;
		return x < q.x;
	}
};

struct data{
	int x, y, val;
	data(int x = 0, int y = 0, int val = 0) : x(x), y(y), val(val) {}
	bool operator < (const data &d) const {
		if (x == d.x) return y < d.y;
		return x < d.x;
	}
};

const int N = 210000;
const int M = 40;
PT V[M], P[M], Q[M], F[N], R[N][M], DX[M], DY[M];;
int a[N];
long long b[N];
long long ans[N];
vector<DB> VX[M], VY[M];
vector<data> D[M];
vector<query> QR[M];

PT trans(PT P, PT O, PT X, PT Y) {
	return PT(((P.x - O.x) * Y.y - (P.y - O.y) * Y.x) / (X.x * Y.y - X.y * Y.x), ((P.x - O.x) * X.y - (P.y - O.y) * X.x) / (X.y * Y.x - X.x * Y.y));
}

void add(int x, int y) {
	for (x += 2; x < N; x += x & -x) b[x] += y;
}

long long get(int x) {
	long long ret = 0;
	for (x += 2; x; x -= x & -x) ret += b[x];
	return ret;
}

int main() {
//	freopen("in.txt", "r", stdin);
	int k, n, q; scanf("%d%d%d", &k, &n, &q);
	int m = 1;
	P[0] = PT(0, 0);
	for (int i = 0; i < k; i++) {
		V[i].in();
		for (int j = 0; j < m; j++) Q[j] = P[j] - V[i], Q[j + m] = P[j] + V[i];
		m = convex_hull(Q, m + m, P);
	}
	long long sum = 0;
	for (int i = 0; i < n; i++) {
		F[i].in(); scanf("%d", &a[i]);
		sum += a[i];
		for (int j = 0; j < m; j++) {
			DX[j] = P[j] - P[(j - 1 + m) % m];
			DY[j] = P[(j + 1) % m] - P[j];
			R[i][j] = trans(F[i], P[j], DX[j], DY[j]);
			VX[j].push_back(R[i][j].x);
			VY[j].push_back(R[i][j].y);
		}
	}
	for (int j = 0; j < m; j++) {
		sort(VX[j].begin(), VX[j].end());
		sort(VY[j].begin(), VY[j].end());
	}
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < m; j++) {
			int x = lower_bound(VX[j].begin(), VX[j].end(), R[i][j].x - EPS) - VX[j].begin();
			int y = lower_bound(VY[j].begin(), VY[j].end(), R[i][j].y - EPS) - VY[j].begin();
			D[j].push_back(data(x, y, a[i]));
		}
	}
	for (int i = 0; i < m; i++) sort(D[i].begin(), D[i].end());
	for (int i = 0; i < q; i++) {
		PT S; S.in(); double _t; scanf("%lf", &_t);
		DB t = _t;
		for (int j = 0; j < m; j++) {
			PT ret = trans(S + P[j] * t, P[j], DX[j], DY[j]);
			int x = upper_bound(VX[j].begin(), VX[j].end(), ret.x + EPS) - VX[j].begin() - 1;
			int y = lower_bound(VY[j].begin(), VY[j].end(), ret.y - EPS) - VY[j].begin() - 1;
			QR[j].push_back(query(i, x, y, -1));
		}
	}
	for (int i = 0; i < m; i++) sort(QR[i].begin(), QR[i].end());
	for (int i = 0; i < m; i++) {
		int dn = 0, qn = 0;
		memset(b, 0, sizeof b);
		for (int j = -1; j < N; j++) {
			vector<pair<int, long long>> vec;
			long long cur = 0;
			while (dn < D[i].size() && D[i][dn].x == j) {
				add(D[i][dn].y, D[i][dn].val);
				vec.push_back(make_pair(D[i][dn].y, cur));
				cur += D[i][dn].val;
				++dn;
			}
			while (qn < QR[i].size() && QR[i][qn].x == j) {
				ans[QR[i][qn].qid] -= get(QR[i][qn].y);
				++qn;
			}
		}
	}
	for (int i = 0; i < q; i++) printf("%lld\n", sum + ans[i]);
}


#ifndef __clang__
#pragma GCC optimize "-O3"
#pragma GCC target "tune=native"
#endif
#ifdef ONLINE_JUDGE
#define NDEBUG 1
#endif
#include <stdio.h>
#include <bits/stdc++.h>

#define DESTRUCT2(p, a, b)                      \
  auto a = get<0>(p);                           \
  auto b = get<1>(p);

#define DESTRUCT3(p, a, b, c)                   \
  auto a = get<0>(p);                           \
  auto b = get<1>(p);                           \
  auto c = get<2>(p);

#define DESTRUCT4(p, a, b, c, d)                \
  auto a = get<0>(p);                           \
  auto b = get<1>(p);                           \
  auto c = get<2>(p);                           \
  auto d = get<3>(p);

#define FOR(i, n)     for(lli i = 0; i < (lli)(n); ++i)
#define FORU(i, j, k) for(lli i = (j); i <= (lli)(k); ++i)
#define FORD(i, j, k) for(lli i = (j); i >= (lli)(k); --i)

#define SQ(x) ((x)*(x))

#define all(x) begin(x), end(x)
#define rall(x) rbegin(x), rend(x)
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define eb emplace_back

using namespace std;

template<typename... As>
struct tpl : public std::tuple<As...> {
  using std::tuple<As...>::tuple;
  tpl(){}
  tpl(std::tuple<As...> const& b) { std::tuple<As...>::operator=(b); }

  template<typename T = tuple<As...> >
  typename tuple_element<0, T>::type const&
  x() const { return get<0>(*this); }
  template<typename T = tuple<As...> >
  typename tuple_element<0, T>::type&
  x() { return get<0>(*this); }

  template<typename T = tuple<As...> >
  typename tuple_element<1, T>::type const&
  y() const { return get<1>(*this); }
  template<typename T = tuple<As...> >
  typename tuple_element<1, T>::type&
  y() { return get<1>(*this); }

  template<typename T = tuple<As...> >
  typename tuple_element<2, T>::type const&
  z() const { return get<2>(*this); }
  template<typename T = tuple<As...> >
  typename tuple_element<2, T>::type&
  z() { return get<2>(*this); }

  template<typename T = tuple<As...> >
  typename tuple_element<3, T>::type const&
  w() const { return get<3>(*this); }
  template<typename T = tuple<As...> >
  typename tuple_element<3, T>::type&
  w() { return get<3>(*this); }
};

using lli   = long long int;
using llu   = long long unsigned;

using pii   = tpl<lli, lli>;
using piii  = tpl<lli, lli, lli>;
using piiii = tpl<lli, lli, lli, lli>;
using vi    = vector<lli>;
using vii   = vector<pii>;
using viii  = vector<piii>;
using vvi   = vector<vi>;
using vvii  = vector<vii>;
using vviii = vector<viii>;

template<class T>
using min_queue = priority_queue<T, vector<T>, greater<T> >;
template<class T>
using max_queue = priority_queue<T>;

template<size_t... I>
struct my_index_sequence {
  using type = my_index_sequence;
  static constexpr array<size_t, sizeof...(I)> value = { {I...} };
};

namespace my_index_sequence_detail {
  template<typename I, typename J> struct concat;
  template<size_t... I, size_t... J>
  struct concat<my_index_sequence<I...>, my_index_sequence<J...> > :
    my_index_sequence<I..., (sizeof...(I)+J)...> { };
  template<size_t N> struct make_index_sequence :
    concat<typename make_index_sequence<N/2>::type, typename make_index_sequence<N-N/2>::type>::type { };
  template <> struct make_index_sequence<0> : my_index_sequence<>{};
  template <> struct make_index_sequence<1> : my_index_sequence<0>{};
}

template<class... A>
using my_index_sequence_for = typename my_index_sequence_detail::make_index_sequence<sizeof...(A)>::type;

template<class T, size_t... I>
void print_tuple(ostream& s, T const& a, my_index_sequence<I...>){
  using swallow = int[];
  (void)swallow{0, (void(s << (I == 0? "" : ", ") << get<I>(a)), 0)...};
}

template<class T>
ostream& print_collection(ostream& s, T const& a);
template<class... A>
ostream& operator<<(ostream& s, tpl<A...> const& a);
template<class... A>
ostream& operator<<(ostream& s, tuple<A...> const& a);
template<class A, class B>
ostream& operator<<(ostream& s, pair<A, B> const& a);

template<class T, size_t I>
ostream& operator<<(ostream& s, array<T, I> const& a) { return print_collection(s, a); }
template<class T>
ostream& operator<<(ostream& s, vector<T> const& a) { return print_collection(s, a); }
template<class T, class U>
ostream& operator<<(ostream& s, multimap<T, U> const& a) { return print_collection(s, a); }
template<class T>
ostream& operator<<(ostream& s, multiset<T> const& a) { return print_collection(s, a); }
template<class T, class U>
ostream& operator<<(ostream& s, map<T, U> const& a) { return print_collection(s, a); }
template<class T>
ostream& operator<<(ostream& s, set<T> const& a) { return print_collection(s, a); }

template<class T>
ostream& print_collection(ostream& s, T const& a){
  s << '[';
  for(auto it = begin(a); it != end(a); ++it){
    s << *it;
    if(it != prev(end(a))) s << " ";
  }
  return s << ']';
}

template<class... A>
ostream& operator<<(ostream& s, tpl<A...> const& a){
  s << '(';
  print_tuple(s, a, my_index_sequence_for<A...>{});
  return s << ')';
}

template<class... A>
ostream& operator<<(ostream& s, tuple<A...> const& a){
  s << '(';
  print_tuple(s, a, my_index_sequence_for<A...>{});
  return s << ')';
}

template<class A, class B>
ostream& operator<<(ostream& s, pair<A, B> const& a){
  return s << "(" << get<0>(a) << ", " << get<1>(a) << ")";
}

//------------------------------------------------------------------------------

void readii(pii& p) { cin>>p.x()>>p.y(); }

using rational = long double;
const rational EPS = 1e-11;

// struct rational {
//   rational() : x(0),y(1){ }
//   rational(lli a) : x(a), y(1){}
//   rational(lli a, lli b) {
//     lli g = __gcd(a,b);
//     a/=g; b/=g;
//     if(b<0) { a*=-1; b*=-1; }
//     x=a; y=b;
//   }
//   rational operator+(rational const& b) const {
//     return rational(x*b.y+y*b.x,y*b.y);
//   }
//   rational operator-(rational const& b) const {
//     return rational(x*b.y-y*b.x,y*b.y);
//   }
//   rational operator*(rational const& b) const {
//     return rational(x*b.x,y*b.y);
//   }
//   rational operator/(rational const& b) const {
//     return rational(x*b.y,y*b.x);
//   }
//   bool operator<(rational const& o) const {
//     return x*o.y<o.x*y;
//   }
//   bool operator<=(rational const& o) const {
//     return x*o.y<=o.x*y;
//   }

//   long double dbl() const { return (long double)x/(long double)y; }
//   lli x,y;
// };
// const rational EPS(0,1);

// ostream& operator<<(ostream& s, rational const& r) {
//   return s << r.x << "/" << r.y;
// }

struct BIT {
  vi A;
  BIT(lli n) : A(n+1){ }

  lli get(lli i){
    if(i<0) return 0;
    i += 1;
    lli r = 0;
    for(; i > 0; i -= i &-i){
      r += A[i];
    }
    return r;
  }

  lli getR(lli l, lli r) {
    lli ans = get(r);
    if(l) ans -= get(l-1);
    return ans;
  }

  void add(lli i, lli v){
    if(i<0) return;
    i += 1;
    for(; i < (lli)A.size(); i += i & -i){
      A[i] += v;
    }
  }
};

// --- END SNIPPET BINARY INDEXED TREE ---

const int N = 100000;
pii F[N];
lli A[N];
pii Q[N];
lli T[N];
lli ANS[N];

template<class T>
tpl<T,T> operator+(tpl<T,T> const& a, tpl<T,T> const& b) {
  return tpl<T,T>(a.x()+b.x(),a.y()+b.y());
}

template<class T>
tpl<T,T> operator-(tpl<T,T> const& a, tpl<T,T> const& b) {
  return tpl<T,T>(a.x()-b.x(),a.y()-b.y());
}

template<class T>
T dot(tpl<T,T> const& a, tpl<T,T> const& b) {
  return a.x()*b.x()+a.y()*b.y();
}

template<class T>
T det(tpl<T,T> const& a, tpl<T,T> const& b) {
  return a.x()*b.y()-a.y()*b.x();
}

lli ata[2][N];
lli atb[2][N];

int main(){
  ios::sync_with_stdio(0); cin.tie(0);
  lli k,n,q; cin>>k>>n>>q;
  vector<tpl<rational,rational>> P;
  { vector<tpl<rational,rational>> P2;
    FOR(i,k) {
      lli x,y;
#ifdef LOCAL
      x=rand()%1000; y=rand()%1000;
#else
      cin>>x>>y;
#endif
      P2.pb(tpl<rational,rational>(2*x,2*y));
      P2.pb(tpl<rational,rational>(-2*x,-2*y));
    }
    // sort(all(P2), [&](auto const& a, auto const& b) { return atan2(a.y().dbl(),a.x().dbl())<atan2(b.y().dbl(),b.x().dbl()); });
    sort(all(P2), [&](auto const& a, auto const& b) { return atan2(a.y(),a.x())<atan2(b.y(),b.x()); });
    P.pb(mt(0,0));
    FOR(i,2*k-1) P.pb(P.back() + P2[i]);
    tpl<rational,rational> center;
    FOR(i,2*k) center = center + P[i];
    center.x() = center.x()/rational(P.size()); center.y() = center.y()/rational(P.size());
    FOR(i,2*k) P[i] = P[i] - center;
  }
  //
  map<pii,lli> XX;
  FOR(i,n) {
#ifdef LOCAL
    F[i] = mt(rand()%1000000,rand()%1000000); A[i] = 1+rand()%100;
#else
    readii(F[i]); cin>>A[i];
#endif
    XX[F[i]]+=A[i];
  }
  FOR(i,q) {
#ifdef LOCAL
    Q[i] = mt(rand()%1000000,rand()%1000000); T[i] = 1+rand()%5;
#else
    readii(Q[i]); cin>>T[i];
#endif
    ANS[i] += XX[Q[i]];
  }
  //
  FOR(k_,2*k) {
    auto p0 = P[k_], p1 = P[(k_+1)%(2*k)];
    auto dt = det(p0,p1);
    vector<tpl<rational,rational,rational,lli,lli>> pts;
    vector<tpl<rational,rational,rational,lli>> qs;
    vector<tpl<rational,rational,lli,lli>> pts2;
    vector<tpl<rational,rational,lli>> qs2;
    vector<tpl<rational,lli,lli> > as,bs;
    FOR(i,n) {
      rational a = (p1.y() * F[i].x() - p1.x() * F[i].y()) / dt;
      rational b = (p0.x() * F[i].y() - p0.y() * F[i].x()) / dt;
      as.pb(mt(a,0,i)); bs.pb(mt(b,1,i));
      pts.pb(mt(a+b,a,b,i,A[i]));
      pts2.pb(mt(a,b,i,A[i]));
    }
    FOR(i,q) {
      rational a = (p1.y() * Q[i].x() - p1.x() * Q[i].y()) / dt;
      rational b = (p0.x() * Q[i].y() - p0.y() * Q[i].x()) / dt;
      as.pb(mt(a,1,i)); bs.pb(mt(b,0,i));
      qs.pb(mt(a+b+T[i],a,b,i));
      qs2.pb(mt(a,b,i));
    }
    sort(all(as)); sort(all(bs));
    FOR(i,as.size()) ata[as[i].y()][as[i].z()]=i;
    FOR(i,bs.size()) atb[bs[i].y()][bs[i].z()]=i;

    // Sweep 1
    sort(all(pts)); sort(all(qs));
    lli pts_i = 0;
    lli allV = 0;
    BIT ta(as.size()+1), tb(bs.size()+1);
    for(auto const& ev : qs) {
      rational ab,a,b; lli i; tie(ab,a,b,i) = ev;
      while(pts_i<(lli)pts.size() && pts[pts_i].x() <= ab+EPS) {
        rational a,b; lli j,x; tie(ignore,a,b,j,x) = pts[pts_i];
        ta.add(ata[0][j],x);
        tb.add(atb[1][j],x);
        allV += x;
        pts_i++;
      }
      ANS[i] += allV;
      ANS[i] -= ta.get(ata[1][i]);
      ANS[i] -= tb.get(atb[0][i]);
    }
    // Sweep 2
    sort(all(pts2)); sort(all(qs2));
    pts_i = 0;
    BIT ts(bs.size()+1);
    for(auto const& ev : qs2) {
      rational a,b; lli i; tie(a,b,i) = ev;
      while(pts_i<(lli)pts2.size() && pts2[pts_i].x() <= a+EPS) {
        rational b; lli j,x; tie(ignore,b,j,x) = pts2[pts_i];
        ts.add(atb[1][j],x);
        pts_i++;
      }
      ANS[i] += ts.get(atb[0][i]);
    }
  }
  //
  FOR(i,q) cout << ANS[i] << '\n';
  cout << flush;
  exit(0);
  return 0;
}


#ifndef __clang__
#pragma GCC optimize "-O3"
#pragma GCC target "tune=native"
#endif
#ifdef ONLINE_JUDGE
#define NDEBUG 1
#endif
#include <stdio.h>
#include <bits/stdc++.h>

#define DESTRUCT2(p, a, b)                      \
  auto a = get<0>(p);                           \
  auto b = get<1>(p);

#define DESTRUCT3(p, a, b, c)                   \
  auto a = get<0>(p);                           \
  auto b = get<1>(p);                           \
  auto c = get<2>(p);

#define DESTRUCT4(p, a, b, c, d)                \
  auto a = get<0>(p);                           \
  auto b = get<1>(p);                           \
  auto c = get<2>(p);                           \
  auto d = get<3>(p);

#define FOR(i, n)     for(lli i = 0; i < (lli)(n); ++i)
#define FORU(i, j, k) for(lli i = (j); i <= (lli)(k); ++i)
#define FORD(i, j, k) for(lli i = (j); i >= (lli)(k); --i)

#define SQ(x) ((x)*(x))

#define all(x) begin(x), end(x)
#define rall(x) rbegin(x), rend(x)
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define eb emplace_back

using namespace std;

template<typename... As>
struct tpl : public std::tuple<As...> {
  using std::tuple<As...>::tuple;
  tpl(){}
  tpl(std::tuple<As...> const& b) { std::tuple<As...>::operator=(b); }

  template<typename T = tuple<As...> >
  typename tuple_element<0, T>::type const&
  x() const { return get<0>(*this); }
  template<typename T = tuple<As...> >
  typename tuple_element<0, T>::type&
  x() { return get<0>(*this); }

  template<typename T = tuple<As...> >
  typename tuple_element<1, T>::type const&
  y() const { return get<1>(*this); }
  template<typename T = tuple<As...> >
  typename tuple_element<1, T>::type&
  y() { return get<1>(*this); }

  template<typename T = tuple<As...> >
  typename tuple_element<2, T>::type const&
  z() const { return get<2>(*this); }
  template<typename T = tuple<As...> >
  typename tuple_element<2, T>::type&
  z() { return get<2>(*this); }

  template<typename T = tuple<As...> >
  typename tuple_element<3, T>::type const&
  w() const { return get<3>(*this); }
  template<typename T = tuple<As...> >
  typename tuple_element<3, T>::type&
  w() { return get<3>(*this); }
};

using lli   = long long int;
using llu   = long long unsigned;

using pii   = tpl<lli, lli>;
using piii  = tpl<lli, lli, lli>;
using piiii = tpl<lli, lli, lli, lli>;
using vi    = vector<lli>;
using vii   = vector<pii>;
using viii  = vector<piii>;
using vvi   = vector<vi>;
using vvii  = vector<vii>;
using vviii = vector<viii>;

template<class T>
using min_queue = priority_queue<T, vector<T>, greater<T> >;
template<class T>
using max_queue = priority_queue<T>;

template<size_t... I>
struct my_index_sequence {
  using type = my_index_sequence;
  static constexpr array<size_t, sizeof...(I)> value = { {I...} };
};

namespace my_index_sequence_detail {
  template<typename I, typename J> struct concat;
  template<size_t... I, size_t... J>
  struct concat<my_index_sequence<I...>, my_index_sequence<J...> > :
    my_index_sequence<I..., (sizeof...(I)+J)...> { };
  template<size_t N> struct make_index_sequence :
    concat<typename make_index_sequence<N/2>::type, typename make_index_sequence<N-N/2>::type>::type { };
  template <> struct make_index_sequence<0> : my_index_sequence<>{};
  template <> struct make_index_sequence<1> : my_index_sequence<0>{};
}

template<class... A>
using my_index_sequence_for = typename my_index_sequence_detail::make_index_sequence<sizeof...(A)>::type;

template<class T, size_t... I>
void print_tuple(ostream& s, T const& a, my_index_sequence<I...>){
  using swallow = int[];
  (void)swallow{0, (void(s << (I == 0? "" : ", ") << get<I>(a)), 0)...};
}

template<class T>
ostream& print_collection(ostream& s, T const& a);
template<class... A>
ostream& operator<<(ostream& s, tpl<A...> const& a);
template<class... A>
ostream& operator<<(ostream& s, tuple<A...> const& a);
template<class A, class B>
ostream& operator<<(ostream& s, pair<A, B> const& a);

template<class T, size_t I>
ostream& operator<<(ostream& s, array<T, I> const& a) { return print_collection(s, a); }
template<class T>
ostream& operator<<(ostream& s, vector<T> const& a) { return print_collection(s, a); }
template<class T, class U>
ostream& operator<<(ostream& s, multimap<T, U> const& a) { return print_collection(s, a); }
template<class T>
ostream& operator<<(ostream& s, multiset<T> const& a) { return print_collection(s, a); }
template<class T, class U>
ostream& operator<<(ostream& s, map<T, U> const& a) { return print_collection(s, a); }
template<class T>
ostream& operator<<(ostream& s, set<T> const& a) { return print_collection(s, a); }

template<class T>
ostream& print_collection(ostream& s, T const& a){
  s << '[';
  for(auto it = begin(a); it != end(a); ++it){
    s << *it;
    if(it != prev(end(a))) s << " ";
  }
  return s << ']';
}

template<class... A>
ostream& operator<<(ostream& s, tpl<A...> const& a){
  s << '(';
  print_tuple(s, a, my_index_sequence_for<A...>{});
  return s << ')';
}

template<class... A>
ostream& operator<<(ostream& s, tuple<A...> const& a){
  s << '(';
  print_tuple(s, a, my_index_sequence_for<A...>{});
  return s << ')';
}

template<class A, class B>
ostream& operator<<(ostream& s, pair<A, B> const& a){
  return s << "(" << get<0>(a) << ", " << get<1>(a) << ")";
}

//------------------------------------------------------------------------------

void readii(pii& p) { cin>>p.x()>>p.y(); }

using rational = double;
const rational EPS = 1e-6;

// struct rational {
//   rational() : x(0),y(1){ }
//   rational(lli a) : x(a), y(1){}
//   rational(lli a, lli b) {
//     lli g = __gcd(a,b);
//     a/=g; b/=g;
//     if(b<0) { a*=-1; b*=-1; }
//     x=a; y=b;
//   }
//   rational operator+(rational const& b) const {
//     return rational(x*b.y+y*b.x,y*b.y);
//   }
//   rational operator-(rational const& b) const {
//     return rational(x*b.y-y*b.x,y*b.y);
//   }
//   rational operator*(rational const& b) const {
//     return rational(x*b.x,y*b.y);
//   }
//   rational operator/(rational const& b) const {
//     return rational(x*b.y,y*b.x);
//   }
//   bool operator<(rational const& o) const {
//     return x*o.y<o.x*y;
//   }
//   bool operator<=(rational const& o) const {
//     return x*o.y<=o.x*y;
//   }

//   long double dbl() const { return (long double)x/(long double)y; }
//   lli x,y;
// };
// const rational EPS(0,1);

// ostream& operator<<(ostream& s, rational const& r) {
//   return s << r.x << "/" << r.y;
// }

// --- BEGIN SNIPPET TREAP ---

// struct treap;
// using treap_ptr = treap*;

// struct treap {
//   treap(rational x_, lli y_) : l(0), r(0), heap(rand()), x(x_), y(y_), sum(y) { }
//   treap_ptr l, r;
//   lli heap;

//   rational x;
//   lli y,sum;

//   static lli get_sum(treap_ptr a){ return a?a->sum:0; }

//   static void update(treap_ptr a){
//     if(a){
//       a->sum = a->y;
//       if(a->l) a->sum += a->l->sum;
//       if(a->r) a->sum += a->r->sum;
//     }
//   }

//   static void push(treap_ptr){ }

//   static treap_ptr merge(treap_ptr a, treap_ptr b){
//     if(a == 0) return b;
//     if(b == 0) return a;
//     push(a); push(b);
//     if(a->heap < b->heap){
//       a->r = merge(a->r, b);
//       update(a);
//       return a;
//     }else{
//       b->l = merge(a, b->l);
//       update(b);
//       return b;
//     }
//   }

//   static tpl<treap_ptr, treap_ptr> split_key(treap_ptr a, rational x){
//     if(a == 0) return mt(nullptr, nullptr);
//     push(a);
//     if(x <= a->x){
//       auto p = split_key(a->l, x);
//       a->l = p.y();
//       update(a);
//       return mt(p.x(), a);
//     }else{
//       auto p = split_key(a->r, x);
//       a->r = p.x();
//       update(a);
//       return mt(a, p.y());
//     }
//   }

//   // static tpl<treap_ptr, treap_ptr> split_pos(treap_ptr a, lli i){
//   //   if(a == 0) return mt(nullptr, nullptr);
//   //   push(a);
//   //   if(i <= get_size(a->l)){
//   //     auto p = split_pos(a->l, i);
//   //     a->l = p.y();
//   //     update(a);
//   //     return mt(p.x(), a);
//   //   }else{
//   //     auto p = split_pos(a->r, i - get_size(a->l) - 1);
//   //     a->r = p.x();
//   //     update(a);
//   //     return mt(a, p.y());
//   //   }
//   // }

//   static treap_ptr insert_key(treap_ptr a, rational x, lli y){
//     auto p = split_key(a, x);
//     return merge(merge(p.x(), new treap(x,y)), p.y());
//   }

//   // static treap_ptr insert_pos(treap_ptr a, lli i, rational x, lli y){
//   //   auto p = split_pos(a, i);
//   //   return merge(merge(p.x(), new treap(x,y)), p.y());
//   // }
// };

// --- END SNIPPET TREAP ---

// --- BEGIN SNIPPET BINARY INDEXED TREE ---

struct BIT {
  vi A;
  BIT(lli n) : A(n+1){ }

  lli get(lli i){
    if(i<0) return 0;
    i += 1;
    lli r = 0;
    for(; i > 0; i -= i &-i){
      r += A[i];
    }
    return r;
  }

  lli getR(lli l, lli r) {
    lli ans = get(r);
    if(l) ans -= get(l-1);
    return ans;
  }

  void add(lli i, lli v){
    if(i<0) return;
    i += 1;
    for(; i < (lli)A.size(); i += i & -i){
      A[i] += v;
    }
  }
};

// --- END SNIPPET BINARY INDEXED TREE ---

const int N = 100000;
pii F[N];
lli A[N];
pii Q[N];
lli T[N];
lli ANS[N];

template<class T>
tpl<T,T> operator+(tpl<T,T> const& a, tpl<T,T> const& b) {
  return tpl<T,T>(a.x()+b.x(),a.y()+b.y());
}

template<class T>
tpl<T,T> operator-(tpl<T,T> const& a, tpl<T,T> const& b) {
  return tpl<T,T>(a.x()-b.x(),a.y()-b.y());
}

template<class T>
T dot(tpl<T,T> const& a, tpl<T,T> const& b) {
  return a.x()*b.x()+a.y()*b.y();
}

template<class T>
T det(tpl<T,T> const& a, tpl<T,T> const& b) {
  return a.x()*b.y()-a.y()*b.x();
}

int ata[2][N];
int atb[2][N];

int main(){
  ios::sync_with_stdio(0); cin.tie(0);
  int k,n,q; cin>>k>>n>>q;
  vector<tpl<rational,rational>> P;
  { vector<tpl<rational,rational>> P2;
    FOR(i,k) {
      lli x,y;
      // x=rand()%1000; y=rand()%1000;
       cin>>x>>y;
      P2.pb(tpl<rational,rational>(2*x,2*y));
      P2.pb(tpl<rational,rational>(-2*x,-2*y));
    }
    // sort(all(P2), [&](auto const& a, auto const& b) { return atan2(a.y().dbl(),a.x().dbl())<atan2(b.y().dbl(),b.x().dbl()); });
    sort(all(P2), [&](auto const& a, auto const& b) { return atan2(a.y(),a.x())<atan2(b.y(),b.x()); });
    P.pb(mt(0,0));
    FOR(i,2*k-1) P.pb(P.back() + P2[i]);
    tpl<rational,rational> center;
    FOR(i,2*k) center = center + P[i];
    center.x() = center.x()/rational(P.size()); center.y() = center.y()/rational(P.size());
    FOR(i,2*k) P[i] = P[i] - center;
  }
  //
  FOR(i,n) {
    // F[i] = mt(rand()%1000000,rand()%1000000); A[i] = 1+rand()%100;
     readii(F[i]); cin>>A[i];
  }
  FOR(i,q) {
    // Q[i] = mt(rand()%1000000,rand()%1000000); T[i] = 1+rand()%5;
    readii(Q[i]); cin>>T[i];
  }
  //
  FOR(k_,2*k) {
    auto p0 = P[k_], p1 = P[(k_+1)%(2*k)];
    auto dt = det(p0,p1);
    vector<tpl<rational,rational,rational,lli,lli>> pts;
    vector<tpl<rational,rational,rational,lli>> qs;
    vector<tpl<rational,rational,lli,lli>> pts2;
    vector<tpl<rational,rational,lli>> qs2;
    vector<tpl<double,int,int> > as,bs;
    FOR(i,n) {
      rational a = (p1.y() * F[i].x() - p1.x() * F[i].y()) / dt;
      rational b = (p0.x() * F[i].y() - p0.y() * F[i].x()) / dt;
      as.pb(mt(a,0,i)); bs.pb(mt(b,1,i));
      pts.pb(mt(a+b,a,b,i,A[i]));
      pts2.pb(mt(a,b,i,A[i]));
    }
    FOR(i,q) {
      rational a = (p1.y() * Q[i].x() - p1.x() * Q[i].y()) / dt;
      rational b = (p0.x() * Q[i].y() - p0.y() * Q[i].x()) / dt;
      as.pb(mt(a,1,i)); bs.pb(mt(b,0,i));
      qs.pb(mt(a+b+T[i],a,b,i));
      qs2.pb(mt(a,b,i));
    }
    sort(all(as)); sort(all(bs));
    FOR(i,as.size()) ata[as[i].y()][as[i].z()]=i;
    FOR(i,bs.size()) atb[bs[i].y()][bs[i].z()]=i;
    // unordered_map<double,int> ias,ibs;
    // ias.reserve(as.size());
    // ibs.reserve(bs.size());
    // FOR(i,as.size()) ias[as[i]]=i;
    // FOR(i,bs.size()) ibs[bs[i]]=i;

    // Sweep 1
    sort(all(pts)); sort(all(qs));
    int pts_i = 0;
    lli allV = 0;
    BIT ta(as.size()+1), tb(bs.size()+1);
    for(auto const& ev : qs) {
      rational ab,a,b; lli i; tie(ab,a,b,i) = ev;
      while(pts_i<(int)pts.size() && pts[pts_i].x() <= ab+EPS) {
        rational a,b; lli j,x; tie(ignore,a,b,j,x) = pts[pts_i];
        ta.add(ata[0][j],x);
        tb.add(atb[1][j],x);
        allV += x;
        pts_i++;
      }
      ANS[i] += allV;
      ANS[i] -= ta.get(ata[1][i]);
      ANS[i] -= tb.get(atb[0][i]);
    }
    // Sweep 2
    sort(all(pts2)); sort(all(qs2));
    pts_i = 0;
    BIT ts(bs.size()+1);
    for(auto const& ev : qs2) {
      rational a,b; lli i; tie(a,b,i) = ev;
      while(pts_i<(int)pts2.size() && pts2[pts_i].x() <= a+EPS) {
        rational b; lli j,x; tie(ignore,b,j,x) = pts2[pts_i];
        ts.add(atb[1][j],x);
        pts_i++;
      }
      ANS[i] += ts.get(atb[0][i]);
    }
  }
  //
  FOR(i,q) cout << ANS[i] << '\n';
  cout << flush;
  return 0;
}


#ifndef __clang__
#pragma GCC optimize "-O3"
#pragma GCC target "tune=native"
#endif
#ifdef ONLINE_JUDGE
#define NDEBUG 1
#endif
#include <stdio.h>
#include <bits/stdc++.h>

#define DESTRUCT2(p, a, b)                      \
  auto a = get<0>(p);                           \
  auto b = get<1>(p);

#define DESTRUCT3(p, a, b, c)                   \
  auto a = get<0>(p);                           \
  auto b = get<1>(p);                           \
  auto c = get<2>(p);

#define DESTRUCT4(p, a, b, c, d)                \
  auto a = get<0>(p);                           \
  auto b = get<1>(p);                           \
  auto c = get<2>(p);                           \
  auto d = get<3>(p);

#define FOR(i, n)     for(lli i = 0; i < (lli)(n); ++i)
#define FORU(i, j, k) for(lli i = (j); i <= (lli)(k); ++i)
#define FORD(i, j, k) for(lli i = (j); i >= (lli)(k); --i)

#define SQ(x) ((x)*(x))

#define all(x) begin(x), end(x)
#define rall(x) rbegin(x), rend(x)
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define eb emplace_back

using namespace std;

template<typename... As>
struct tpl : public std::tuple<As...> {
  using std::tuple<As...>::tuple;
  tpl(){}
  tpl(std::tuple<As...> const& b) { std::tuple<As...>::operator=(b); }

  template<typename T = tuple<As...> >
  typename tuple_element<0, T>::type const&
  x() const { return get<0>(*this); }
  template<typename T = tuple<As...> >
  typename tuple_element<0, T>::type&
  x() { return get<0>(*this); }

  template<typename T = tuple<As...> >
  typename tuple_element<1, T>::type const&
  y() const { return get<1>(*this); }
  template<typename T = tuple<As...> >
  typename tuple_element<1, T>::type&
  y() { return get<1>(*this); }

  template<typename T = tuple<As...> >
  typename tuple_element<2, T>::type const&
  z() const { return get<2>(*this); }
  template<typename T = tuple<As...> >
  typename tuple_element<2, T>::type&
  z() { return get<2>(*this); }

  template<typename T = tuple<As...> >
  typename tuple_element<3, T>::type const&
  w() const { return get<3>(*this); }
  template<typename T = tuple<As...> >
  typename tuple_element<3, T>::type&
  w() { return get<3>(*this); }
};

using lli   = long long int;
using llu   = long long unsigned;

using pii   = tpl<lli, lli>;
using piii  = tpl<lli, lli, lli>;
using piiii = tpl<lli, lli, lli, lli>;
using vi    = vector<lli>;
using vii   = vector<pii>;
using viii  = vector<piii>;
using vvi   = vector<vi>;
using vvii  = vector<vii>;
using vviii = vector<viii>;

template<class T>
using min_queue = priority_queue<T, vector<T>, greater<T> >;
template<class T>
using max_queue = priority_queue<T>;

template<size_t... I>
struct my_index_sequence {
  using type = my_index_sequence;
  static constexpr array<size_t, sizeof...(I)> value = { {I...} };
};

namespace my_index_sequence_detail {
  template<typename I, typename J> struct concat;
  template<size_t... I, size_t... J>
  struct concat<my_index_sequence<I...>, my_index_sequence<J...> > :
    my_index_sequence<I..., (sizeof...(I)+J)...> { };
  template<size_t N> struct make_index_sequence :
    concat<typename make_index_sequence<N/2>::type, typename make_index_sequence<N-N/2>::type>::type { };
  template <> struct make_index_sequence<0> : my_index_sequence<>{};
  template <> struct make_index_sequence<1> : my_index_sequence<0>{};
}

template<class... A>
using my_index_sequence_for = typename my_index_sequence_detail::make_index_sequence<sizeof...(A)>::type;

template<class T, size_t... I>
void print_tuple(ostream& s, T const& a, my_index_sequence<I...>){
  using swallow = int[];
  (void)swallow{0, (void(s << (I == 0? "" : ", ") << get<I>(a)), 0)...};
}

template<class T>
ostream& print_collection(ostream& s, T const& a);
template<class... A>
ostream& operator<<(ostream& s, tpl<A...> const& a);
template<class... A>
ostream& operator<<(ostream& s, tuple<A...> const& a);
template<class A, class B>
ostream& operator<<(ostream& s, pair<A, B> const& a);

template<class T, size_t I>
ostream& operator<<(ostream& s, array<T, I> const& a) { return print_collection(s, a); }
template<class T>
ostream& operator<<(ostream& s, vector<T> const& a) { return print_collection(s, a); }
template<class T, class U>
ostream& operator<<(ostream& s, multimap<T, U> const& a) { return print_collection(s, a); }
template<class T>
ostream& operator<<(ostream& s, multiset<T> const& a) { return print_collection(s, a); }
template<class T, class U>
ostream& operator<<(ostream& s, map<T, U> const& a) { return print_collection(s, a); }
template<class T>
ostream& operator<<(ostream& s, set<T> const& a) { return print_collection(s, a); }

template<class T>
ostream& print_collection(ostream& s, T const& a){
  s << '[';
  for(auto it = begin(a); it != end(a); ++it){
    s << *it;
    if(it != prev(end(a))) s << " ";
  }
  return s << ']';
}

template<class... A>
ostream& operator<<(ostream& s, tpl<A...> const& a){
  s << '(';
  print_tuple(s, a, my_index_sequence_for<A...>{});
  return s << ')';
}

template<class... A>
ostream& operator<<(ostream& s, tuple<A...> const& a){
  s << '(';
  print_tuple(s, a, my_index_sequence_for<A...>{});
  return s << ')';
}

template<class A, class B>
ostream& operator<<(ostream& s, pair<A, B> const& a){
  return s << "(" << get<0>(a) << ", " << get<1>(a) << ")";
}

//------------------------------------------------------------------------------

void readii(pii& p) { cin>>p.x()>>p.y(); }

using rational = long double;
const rational EPS = 1e-12;

// struct rational {
//   rational() : x(0),y(1){ }
//   rational(lli a) : x(a), y(1){}
//   rational(lli a, lli b) {
//     lli g = __gcd(a,b);
//     a/=g; b/=g;
//     if(b<0) { a*=-1; b*=-1; }
//     x=a; y=b;
//   }
//   rational operator+(rational const& b) const {
//     return rational(x*b.y+y*b.x,y*b.y);
//   }
//   rational operator-(rational const& b) const {
//     return rational(x*b.y-y*b.x,y*b.y);
//   }
//   rational operator*(rational const& b) const {
//     return rational(x*b.x,y*b.y);
//   }
//   rational operator/(rational const& b) const {
//     return rational(x*b.y,y*b.x);
//   }
//   bool operator<(rational const& o) const {
//     return x*o.y<o.x*y;
//   }
//   bool operator<=(rational const& o) const {
//     return x*o.y<=o.x*y;
//   }

//   long double dbl() const { return (long double)x/(long double)y; }
//   lli x,y;
// };
// const rational EPS(0,1);

// ostream& operator<<(ostream& s, rational const& r) {
//   return s << r.x << "/" << r.y;
// }

// --- BEGIN SNIPPET TREAP ---

// struct treap;
// using treap_ptr = treap*;

// struct treap {
//   treap(rational x_, lli y_) : l(0), r(0), heap(rand()), x(x_), y(y_), sum(y) { }
//   treap_ptr l, r;
//   lli heap;

//   rational x;
//   lli y,sum;

//   static lli get_sum(treap_ptr a){ return a?a->sum:0; }

//   static void update(treap_ptr a){
//     if(a){
//       a->sum = a->y;
//       if(a->l) a->sum += a->l->sum;
//       if(a->r) a->sum += a->r->sum;
//     }
//   }

//   static void push(treap_ptr){ }

//   static treap_ptr merge(treap_ptr a, treap_ptr b){
//     if(a == 0) return b;
//     if(b == 0) return a;
//     push(a); push(b);
//     if(a->heap < b->heap){
//       a->r = merge(a->r, b);
//       update(a);
//       return a;
//     }else{
//       b->l = merge(a, b->l);
//       update(b);
//       return b;
//     }
//   }

//   static tpl<treap_ptr, treap_ptr> split_key(treap_ptr a, rational x){
//     if(a == 0) return mt(nullptr, nullptr);
//     push(a);
//     if(x <= a->x){
//       auto p = split_key(a->l, x);
//       a->l = p.y();
//       update(a);
//       return mt(p.x(), a);
//     }else{
//       auto p = split_key(a->r, x);
//       a->r = p.x();
//       update(a);
//       return mt(a, p.y());
//     }
//   }

//   // static tpl<treap_ptr, treap_ptr> split_pos(treap_ptr a, lli i){
//   //   if(a == 0) return mt(nullptr, nullptr);
//   //   push(a);
//   //   if(i <= get_size(a->l)){
//   //     auto p = split_pos(a->l, i);
//   //     a->l = p.y();
//   //     update(a);
//   //     return mt(p.x(), a);
//   //   }else{
//   //     auto p = split_pos(a->r, i - get_size(a->l) - 1);
//   //     a->r = p.x();
//   //     update(a);
//   //     return mt(a, p.y());
//   //   }
//   // }

//   static treap_ptr insert_key(treap_ptr a, rational x, lli y){
//     auto p = split_key(a, x);
//     return merge(merge(p.x(), new treap(x,y)), p.y());
//   }

//   // static treap_ptr insert_pos(treap_ptr a, lli i, rational x, lli y){
//   //   auto p = split_pos(a, i);
//   //   return merge(merge(p.x(), new treap(x,y)), p.y());
//   // }
// };

// --- END SNIPPET TREAP ---

// --- BEGIN SNIPPET BINARY INDEXED TREE ---

struct BIT {
  vi A;
  BIT(lli n) : A(n+1){ }

  lli get(lli i){
    if(i<0) return 0;
    i += 1;
    lli r = 0;
    for(; i > 0; i -= i &-i){
      r += A[i];
    }
    return r;
  }

  lli getR(lli l, lli r) {
    lli ans = get(r);
    if(l) ans -= get(l-1);
    return ans;
  }

  void add(lli i, lli v){
    if(i<0) return;
    i += 1;
    for(; i < (lli)A.size(); i += i & -i){
      A[i] += v;
    }
  }
};

// --- END SNIPPET BINARY INDEXED TREE ---

const int N = 100000;
pii F[N];
lli A[N];
pii Q[N];
lli T[N];
lli ANS[N];

template<class T>
tpl<T,T> operator+(tpl<T,T> const& a, tpl<T,T> const& b) {
  return tpl<T,T>(a.x()+b.x(),a.y()+b.y());
}

template<class T>
tpl<T,T> operator-(tpl<T,T> const& a, tpl<T,T> const& b) {
  return tpl<T,T>(a.x()-b.x(),a.y()-b.y());
}

template<class T>
T dot(tpl<T,T> const& a, tpl<T,T> const& b) {
  return a.x()*b.x()+a.y()*b.y();
}

template<class T>
T det(tpl<T,T> const& a, tpl<T,T> const& b) {
  return a.x()*b.y()-a.y()*b.x();
}

lli ata[2][N];
lli atb[2][N];

int main(){
  ios::sync_with_stdio(0); cin.tie(0);
  lli k,n,q; cin>>k>>n>>q;
  vector<tpl<rational,rational>> P;
  { vector<tpl<rational,rational>> P2;
    FOR(i,k) {
      lli x,y;
#ifdef LOCAL
      x=rand()%1000; y=rand()%1000;
#else
      cin>>x>>y;
#endif
      P2.pb(tpl<rational,rational>(2*x,2*y));
      P2.pb(tpl<rational,rational>(-2*x,-2*y));
    }
    // sort(all(P2), [&](auto const& a, auto const& b) { return atan2(a.y().dbl(),a.x().dbl())<atan2(b.y().dbl(),b.x().dbl()); });
    sort(all(P2), [&](auto const& a, auto const& b) { return atan2(a.y(),a.x())<atan2(b.y(),b.x()); });
    P.pb(mt(0,0));
    FOR(i,2*k-1) P.pb(P.back() + P2[i]);
    tpl<rational,rational> center;
    FOR(i,2*k) center = center + P[i];
    center.x() = center.x()/rational(P.size()); center.y() = center.y()/rational(P.size());
    FOR(i,2*k) P[i] = P[i] - center;
  }
  //
  FOR(i,n) {
#ifdef LOCAL
    F[i] = mt(rand()%1000000,rand()%1000000); A[i] = 1+rand()%100;
#else
    readii(F[i]); cin>>A[i];
#endif
  }
  FOR(i,q) {
#ifdef LOCAL
    Q[i] = mt(rand()%1000000,rand()%1000000); T[i] = 1+rand()%5;
#else
    readii(Q[i]); cin>>T[i];
#endif
  }
  //
  FOR(k_,2*k) {
    auto p0 = P[k_], p1 = P[(k_+1)%(2*k)];
    auto dt = det(p0,p1);
    vector<tpl<rational,rational,rational,lli,lli>> pts;
    vector<tpl<rational,rational,rational,lli>> qs;
    vector<tpl<rational,rational,lli,lli>> pts2;
    vector<tpl<rational,rational,lli>> qs2;
    vector<tpl<rational,lli,lli> > as,bs;
    FOR(i,n) {
      rational a = (p1.y() * F[i].x() - p1.x() * F[i].y()) / dt;
      rational b = (p0.x() * F[i].y() - p0.y() * F[i].x()) / dt;
      as.pb(mt(a,0,i)); bs.pb(mt(b,1,i));
      pts.pb(mt(a+b,a,b,i,A[i]));
      pts2.pb(mt(a,b,i,A[i]));
    }
    FOR(i,q) {
      rational a = (p1.y() * Q[i].x() - p1.x() * Q[i].y()) / dt;
      rational b = (p0.x() * Q[i].y() - p0.y() * Q[i].x()) / dt;
      as.pb(mt(a,1,i)); bs.pb(mt(b,0,i));
      qs.pb(mt(a+b+T[i],a,b,i));
      qs2.pb(mt(a,b,i));
    }
    sort(all(as)); sort(all(bs));
    FOR(i,as.size()) ata[as[i].y()][as[i].z()]=i;
    FOR(i,bs.size()) atb[bs[i].y()][bs[i].z()]=i;
    // unordered_map<double,int> ias,ibs;
    // ias.reserve(as.size());
    // ibs.reserve(bs.size());
    // FOR(i,as.size()) ias[as[i]]=i;
    // FOR(i,bs.size()) ibs[bs[i]]=i;

    // Sweep 1
    sort(all(pts)); sort(all(qs));
    lli pts_i = 0;
    lli allV = 0;
    BIT ta(as.size()+1), tb(bs.size()+1);
    for(auto const& ev : qs) {
      rational ab,a,b; lli i; tie(ab,a,b,i) = ev;
      while(pts_i<(lli)pts.size() && pts[pts_i].x() <= ab+EPS) {
        rational a,b; lli j,x; tie(ignore,a,b,j,x) = pts[pts_i];
        ta.add(ata[0][j],x);
        tb.add(atb[1][j],x);
        allV += x;
        pts_i++;
      }
      ANS[i] += allV;
      ANS[i] -= ta.get(ata[1][i]);
      ANS[i] -= tb.get(atb[0][i]);
    }
    // Sweep 2
    sort(all(pts2)); sort(all(qs2));
    pts_i = 0;
    BIT ts(bs.size()+1);
    for(auto const& ev : qs2) {
      rational a,b; lli i; tie(a,b,i) = ev;
      while(pts_i<(lli)pts2.size() && pts2[pts_i].x() <= a+EPS) {
        rational b; lli j,x; tie(ignore,b,j,x) = pts2[pts_i];
        ts.add(atb[1][j],x);
        pts_i++;
      }
      ANS[i] += ts.get(atb[0][i]);
    }
  }
  //
  FOR(i,q) cout << ANS[i] << '\n';
  cout << flush;
  return 0;
}


#ifndef __clang__
#pragma GCC optimize "-O3"
#pragma GCC target "tune=native"
#endif
#ifdef ONLINE_JUDGE
#define NDEBUG 1
#endif
#include <stdio.h>
#include <bits/stdc++.h>

#define DESTRUCT2(p, a, b)                      \
  auto a = get<0>(p);                           \
  auto b = get<1>(p);

#define DESTRUCT3(p, a, b, c)                   \
  auto a = get<0>(p);                           \
  auto b = get<1>(p);                           \
  auto c = get<2>(p);

#define DESTRUCT4(p, a, b, c, d)                \
  auto a = get<0>(p);                           \
  auto b = get<1>(p);                           \
  auto c = get<2>(p);                           \
  auto d = get<3>(p);

#define FOR(i, n)     for(lli i = 0; i < (lli)(n); ++i)
#define FORU(i, j, k) for(lli i = (j); i <= (lli)(k); ++i)
#define FORD(i, j, k) for(lli i = (j); i >= (lli)(k); --i)

#define SQ(x) ((x)*(x))

#define all(x) begin(x), end(x)
#define rall(x) rbegin(x), rend(x)
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define eb emplace_back

using namespace std;

template<typename... As>
struct tpl : public std::tuple<As...> {
  using std::tuple<As...>::tuple;
  tpl(){}
  tpl(std::tuple<As...> const& b) { std::tuple<As...>::operator=(b); }

  template<typename T = tuple<As...> >
  typename tuple_element<0, T>::type const&
  x() const { return get<0>(*this); }
  template<typename T = tuple<As...> >
  typename tuple_element<0, T>::type&
  x() { return get<0>(*this); }

  template<typename T = tuple<As...> >
  typename tuple_element<1, T>::type const&
  y() const { return get<1>(*this); }
  template<typename T = tuple<As...> >
  typename tuple_element<1, T>::type&
  y() { return get<1>(*this); }

  template<typename T = tuple<As...> >
  typename tuple_element<2, T>::type const&
  z() const { return get<2>(*this); }
  template<typename T = tuple<As...> >
  typename tuple_element<2, T>::type&
  z() { return get<2>(*this); }

  template<typename T = tuple<As...> >
  typename tuple_element<3, T>::type const&
  w() const { return get<3>(*this); }
  template<typename T = tuple<As...> >
  typename tuple_element<3, T>::type&
  w() { return get<3>(*this); }
};

using lli   = long long int;
using llu   = long long unsigned;

using pii   = tpl<lli, lli>;
using piii  = tpl<lli, lli, lli>;
using piiii = tpl<lli, lli, lli, lli>;
using vi    = vector<lli>;
using vii   = vector<pii>;
using viii  = vector<piii>;
using vvi   = vector<vi>;
using vvii  = vector<vii>;
using vviii = vector<viii>;

template<class T>
using min_queue = priority_queue<T, vector<T>, greater<T> >;
template<class T>
using max_queue = priority_queue<T>;

template<size_t... I>
struct my_index_sequence {
  using type = my_index_sequence;
  static constexpr array<size_t, sizeof...(I)> value = { {I...} };
};

namespace my_index_sequence_detail {
  template<typename I, typename J> struct concat;
  template<size_t... I, size_t... J>
  struct concat<my_index_sequence<I...>, my_index_sequence<J...> > :
    my_index_sequence<I..., (sizeof...(I)+J)...> { };
  template<size_t N> struct make_index_sequence :
    concat<typename make_index_sequence<N/2>::type, typename make_index_sequence<N-N/2>::type>::type { };
  template <> struct make_index_sequence<0> : my_index_sequence<>{};
  template <> struct make_index_sequence<1> : my_index_sequence<0>{};
}

template<class... A>
using my_index_sequence_for = typename my_index_sequence_detail::make_index_sequence<sizeof...(A)>::type;

template<class T, size_t... I>
void print_tuple(ostream& s, T const& a, my_index_sequence<I...>){
  using swallow = int[];
  (void)swallow{0, (void(s << (I == 0? "" : ", ") << get<I>(a)), 0)...};
}

template<class T>
ostream& print_collection(ostream& s, T const& a);
template<class... A>
ostream& operator<<(ostream& s, tpl<A...> const& a);
template<class... A>
ostream& operator<<(ostream& s, tuple<A...> const& a);
template<class A, class B>
ostream& operator<<(ostream& s, pair<A, B> const& a);

template<class T, size_t I>
ostream& operator<<(ostream& s, array<T, I> const& a) { return print_collection(s, a); }
template<class T>
ostream& operator<<(ostream& s, vector<T> const& a) { return print_collection(s, a); }
template<class T, class U>
ostream& operator<<(ostream& s, multimap<T, U> const& a) { return print_collection(s, a); }
template<class T>
ostream& operator<<(ostream& s, multiset<T> const& a) { return print_collection(s, a); }
template<class T, class U>
ostream& operator<<(ostream& s, map<T, U> const& a) { return print_collection(s, a); }
template<class T>
ostream& operator<<(ostream& s, set<T> const& a) { return print_collection(s, a); }

template<class T>
ostream& print_collection(ostream& s, T const& a){
  s << '[';
  for(auto it = begin(a); it != end(a); ++it){
    s << *it;
    if(it != prev(end(a))) s << " ";
  }
  return s << ']';
}

template<class... A>
ostream& operator<<(ostream& s, tpl<A...> const& a){
  s << '(';
  print_tuple(s, a, my_index_sequence_for<A...>{});
  return s << ')';
}

template<class... A>
ostream& operator<<(ostream& s, tuple<A...> const& a){
  s << '(';
  print_tuple(s, a, my_index_sequence_for<A...>{});
  return s << ')';
}

template<class A, class B>
ostream& operator<<(ostream& s, pair<A, B> const& a){
  return s << "(" << get<0>(a) << ", " << get<1>(a) << ")";
}

//------------------------------------------------------------------------------

void readii(pii& p) { cin>>p.x()>>p.y(); }

using rational = double;
const rational EPS = 1e-6;

// struct rational {
//   rational() : x(0),y(1){ }
//   rational(lli a) : x(a), y(1){}
//   rational(lli a, lli b) {
//     lli g = __gcd(a,b);
//     a/=g; b/=g;
//     if(b<0) { a*=-1; b*=-1; }
//     x=a; y=b;
//   }
//   rational operator+(rational const& b) const {
//     return rational(x*b.y+y*b.x,y*b.y);
//   }
//   rational operator-(rational const& b) const {
//     return rational(x*b.y-y*b.x,y*b.y);
//   }
//   rational operator*(rational const& b) const {
//     return rational(x*b.x,y*b.y);
//   }
//   rational operator/(rational const& b) const {
//     return rational(x*b.y,y*b.x);
//   }
//   bool operator<(rational const& o) const {
//     return x*o.y<o.x*y;
//   }
//   bool operator<=(rational const& o) const {
//     return x*o.y<=o.x*y;
//   }

//   long double dbl() const { return (long double)x/(long double)y; }
//   lli x,y;
// };
// const rational EPS(0,1);

// ostream& operator<<(ostream& s, rational const& r) {
//   return s << r.x << "/" << r.y;
// }

// --- BEGIN SNIPPET TREAP ---

struct treap;
using treap_ptr = treap*;

struct treap {
  treap(rational x_, lli y_) : l(0), r(0), heap(rand()), x(x_), y(y_), sum(y) { }
  treap_ptr l, r;
  lli heap;

  rational x;
  lli y,sum;

  static lli get_sum(treap_ptr a){ return a?a->sum:0; }

  static void update(treap_ptr a){
    if(a){
      a->sum = a->y;
      if(a->l) a->sum += a->l->sum;
      if(a->r) a->sum += a->r->sum;
    }
  }

  static void push(treap_ptr){ }

  static treap_ptr merge(treap_ptr a, treap_ptr b){
    if(a == 0) return b;
    if(b == 0) return a;
    push(a); push(b);
    if(a->heap < b->heap){
      a->r = merge(a->r, b);
      update(a);
      return a;
    }else{
      b->l = merge(a, b->l);
      update(b);
      return b;
    }
  }

  static tpl<treap_ptr, treap_ptr> split_key(treap_ptr a, rational x){
    if(a == 0) return mt(nullptr, nullptr);
    push(a);
    if(x <= a->x){
      auto p = split_key(a->l, x);
      a->l = p.y();
      update(a);
      return mt(p.x(), a);
    }else{
      auto p = split_key(a->r, x);
      a->r = p.x();
      update(a);
      return mt(a, p.y());
    }
  }

  // static tpl<treap_ptr, treap_ptr> split_pos(treap_ptr a, lli i){
  //   if(a == 0) return mt(nullptr, nullptr);
  //   push(a);
  //   if(i <= get_size(a->l)){
  //     auto p = split_pos(a->l, i);
  //     a->l = p.y();
  //     update(a);
  //     return mt(p.x(), a);
  //   }else{
  //     auto p = split_pos(a->r, i - get_size(a->l) - 1);
  //     a->r = p.x();
  //     update(a);
  //     return mt(a, p.y());
  //   }
  // }

  static treap_ptr insert_key(treap_ptr a, rational x, lli y){
    auto p = split_key(a, x);
    return merge(merge(p.x(), new treap(x,y)), p.y());
  }

  // static treap_ptr insert_pos(treap_ptr a, lli i, rational x, lli y){
  //   auto p = split_pos(a, i);
  //   return merge(merge(p.x(), new treap(x,y)), p.y());
  // }
};

// --- END SNIPPET TREAP ---

const int N = 100000;
pii F[N];
lli A[N];
pii Q[N];
lli T[N];
lli ANS[N];

template<class T>
tpl<T,T> operator+(tpl<T,T> const& a, tpl<T,T> const& b) {
  return tpl<T,T>(a.x()+b.x(),a.y()+b.y());
}

template<class T>
tpl<T,T> operator-(tpl<T,T> const& a, tpl<T,T> const& b) {
  return tpl<T,T>(a.x()-b.x(),a.y()-b.y());
}

template<class T>
T dot(tpl<T,T> const& a, tpl<T,T> const& b) {
  return a.x()*b.x()+a.y()*b.y();
}

template<class T>
T det(tpl<T,T> const& a, tpl<T,T> const& b) {
  return a.x()*b.y()-a.y()*b.x();
}

int main(){
  ios::sync_with_stdio(0); cin.tie(0);
  int k,n,q; cin>>k>>n>>q;
  vector<tpl<rational,rational>> P;
  { vector<tpl<rational,rational>> P2;
    FOR(i,k) {
      lli x,y; cin>>x>>y;
      P2.pb(tpl<rational,rational>(2*x,2*y));
      P2.pb(tpl<rational,rational>(-2*x,-2*y));
    }
    // sort(all(P2), [&](auto const& a, auto const& b) { return atan2(a.y().dbl(),a.x().dbl())<atan2(b.y().dbl(),b.x().dbl()); });
    sort(all(P2), [&](auto const& a, auto const& b) { return atan2(a.y(),a.x())<atan2(b.y(),b.x()); });
    P.pb(mt(0,0));
    FOR(i,2*k-1) P.pb(P.back() + P2[i]);
    tpl<rational,rational> center;
    FOR(i,2*k) center = center + P[i];
    center.x() = center.x()/rational(P.size()); center.y() = center.y()/rational(P.size());
    FOR(i,2*k) P[i] = P[i] - center;
  }
  //
  FOR(i,n) {
    readii(F[i]); cin>>A[i];
  }
  FOR(i,q) {
    readii(Q[i]); cin>>T[i];
  }
  //
  FOR(k_,2*k) {
    auto p0 = P[k_], p1 = P[(k_+1)%(2*k)];
    // cerr << "# " << mt(p0,p1) << endl;
    auto dt = det(p0,p1);
    // cerr << "Points: " << endl;
    vector<tpl<rational,rational,rational,lli>> pts;
    vector<tpl<rational,rational,rational,lli>> qs;
    vector<tpl<rational,rational,lli>> pts2;
    vector<tpl<rational,rational,lli>> qs2;
    FOR(i,n) {
      rational a = (p1.y() * F[i].x() - p1.x() * F[i].y()) / dt;
      rational b = (p0.x() * F[i].y() - p0.y() * F[i].x()) / dt;
      // cout << dt << " " << mt(a,b) << endl;
      // cout << a*p0.x()+b*p1.x() << " " << F[i].x() << endl;;
      // cout << a*p0.y()+b*p1.y() << " " << F[i].y() << endl;;
      pts.pb(mt(a+b,a,b,A[i]));
      pts2.pb(mt(a,b,A[i]));
      //cerr << mt(a,b,A[i]) << endl;
    }
    //cerr << "Queries: " << endl;
    FOR(i,q) {
      rational a = (p1.y() * Q[i].x() - p1.x() * Q[i].y()) / dt;
      rational b = (p0.x() * Q[i].y() - p0.y() * Q[i].x()) / dt;
      qs.pb(mt(a+b+T[i],a,b,i));
      qs2.pb(mt(a,b,i));
      //cerr << mt(a,b,T[i]) << endl;
    }
    // Sweep 1
    sort(all(pts)); sort(all(qs));
    // cerr << pts << endl;
    int pts_i = 0;
    lli allV = 0;
    treap_ptr ta=0,tb=0;
    for(auto const& ev : qs) {
      rational ab,a,b; lli i; tie(ab,a,b,i) = ev;
      // cerr << "Q " << ev << endl;
      while(pts_i<(int)pts.size() && pts[pts_i].x() <= ab+EPS) {
        rational a,b; lli x; tie(ignore,a,b,x) = pts[pts_i];
        // cerr << "P " << pts[pts_i] << endl;
        ta = treap::insert_key(ta,a,x);
        tb = treap::insert_key(tb,b,x);
        allV += x;
        pts_i++;
      }
      ANS[i] += allV;
      { auto p = treap::split_key(ta,a+EPS);
        ANS[i] -= treap::get_sum(p.x());
        ta = treap::merge(p.x(),p.y());
      }
      { auto p = treap::split_key(tb,b-EPS);
        ANS[i] -= treap::get_sum(p.x());
        tb = treap::merge(p.x(),p.y());
      }
    }
    // Sweep 2
    sort(all(pts2)); sort(all(qs2));
    pts_i = 0;
    treap_ptr ts=0;
    for(auto const& ev : qs2) {
      rational a,b; lli i; tie(a,b,i) = ev;
      while(pts_i<(int)pts2.size() && pts2[pts_i].x() <= a+EPS) {
        rational b; lli x; tie(ignore,b,x) = pts2[pts_i];
        ts = treap::insert_key(ts,b,x);
        pts_i++;
      }
      { auto p = treap::split_key(ts,b-EPS);
        ANS[i] += treap::get_sum(p.x());
        tb = treap::merge(p.x(),p.y());
      }
    }
    // FOR(i,q) cout << ANS[i] << ' '; cout << endl;
    // FOR(i,q) ANS[i]=0;
  }
  //
  FOR(i,q) cout << ANS[i] << '\n';
  cout << flush;
  return 0;
}


#ifndef __clang__
#pragma GCC optimize "-O3"
#pragma GCC target "tune=native"
#endif
#ifdef ONLINE_JUDGE
#define NDEBUG 1
#endif
#include <stdio.h>
#include <bits/stdc++.h>

#define DESTRUCT2(p, a, b)                      \
  auto a = get<0>(p);                           \
  auto b = get<1>(p);

#define DESTRUCT3(p, a, b, c)                   \
  auto a = get<0>(p);                           \
  auto b = get<1>(p);                           \
  auto c = get<2>(p);

#define DESTRUCT4(p, a, b, c, d)                \
  auto a = get<0>(p);                           \
  auto b = get<1>(p);                           \
  auto c = get<2>(p);                           \
  auto d = get<3>(p);

#define FOR(i, n)     for(lli i = 0; i < (lli)(n); ++i)
#define FORU(i, j, k) for(lli i = (j); i <= (lli)(k); ++i)
#define FORD(i, j, k) for(lli i = (j); i >= (lli)(k); --i)

#define SQ(x) ((x)*(x))

#define all(x) begin(x), end(x)
#define rall(x) rbegin(x), rend(x)
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define eb emplace_back

using namespace std;

template<typename... As>
struct tpl : public std::tuple<As...> {
  using std::tuple<As...>::tuple;
  tpl(){}
  tpl(std::tuple<As...> const& b) { std::tuple<As...>::operator=(b); }

  template<typename T = tuple<As...> >
  typename tuple_element<0, T>::type const&
  x() const { return get<0>(*this); }
  template<typename T = tuple<As...> >
  typename tuple_element<0, T>::type&
  x() { return get<0>(*this); }

  template<typename T = tuple<As...> >
  typename tuple_element<1, T>::type const&
  y() const { return get<1>(*this); }
  template<typename T = tuple<As...> >
  typename tuple_element<1, T>::type&
  y() { return get<1>(*this); }

  template<typename T = tuple<As...> >
  typename tuple_element<2, T>::type const&
  z() const { return get<2>(*this); }
  template<typename T = tuple<As...> >
  typename tuple_element<2, T>::type&
  z() { return get<2>(*this); }

  template<typename T = tuple<As...> >
  typename tuple_element<3, T>::type const&
  w() const { return get<3>(*this); }
  template<typename T = tuple<As...> >
  typename tuple_element<3, T>::type&
  w() { return get<3>(*this); }
};

using lli   = long long int;
using llu   = long long unsigned;

using pii   = tpl<lli, lli>;
using piii  = tpl<lli, lli, lli>;
using piiii = tpl<lli, lli, lli, lli>;
using vi    = vector<lli>;
using vii   = vector<pii>;
using viii  = vector<piii>;
using vvi   = vector<vi>;
using vvii  = vector<vii>;
using vviii = vector<viii>;

template<class T>
using min_queue = priority_queue<T, vector<T>, greater<T> >;
template<class T>
using max_queue = priority_queue<T>;

template<size_t... I>
struct my_index_sequence {
  using type = my_index_sequence;
  static constexpr array<size_t, sizeof...(I)> value = { {I...} };
};

namespace my_index_sequence_detail {
  template<typename I, typename J> struct concat;
  template<size_t... I, size_t... J>
  struct concat<my_index_sequence<I...>, my_index_sequence<J...> > :
    my_index_sequence<I..., (sizeof...(I)+J)...> { };
  template<size_t N> struct make_index_sequence :
    concat<typename make_index_sequence<N/2>::type, typename make_index_sequence<N-N/2>::type>::type { };
  template <> struct make_index_sequence<0> : my_index_sequence<>{};
  template <> struct make_index_sequence<1> : my_index_sequence<0>{};
}

template<class... A>
using my_index_sequence_for = typename my_index_sequence_detail::make_index_sequence<sizeof...(A)>::type;

template<class T, size_t... I>
void print_tuple(ostream& s, T const& a, my_index_sequence<I...>){
  using swallow = int[];
  (void)swallow{0, (void(s << (I == 0? "" : ", ") << get<I>(a)), 0)...};
}

template<class T>
ostream& print_collection(ostream& s, T const& a);
template<class... A>
ostream& operator<<(ostream& s, tpl<A...> const& a);
template<class... A>
ostream& operator<<(ostream& s, tuple<A...> const& a);
template<class A, class B>
ostream& operator<<(ostream& s, pair<A, B> const& a);

template<class T, size_t I>
ostream& operator<<(ostream& s, array<T, I> const& a) { return print_collection(s, a); }
template<class T>
ostream& operator<<(ostream& s, vector<T> const& a) { return print_collection(s, a); }
template<class T, class U>
ostream& operator<<(ostream& s, multimap<T, U> const& a) { return print_collection(s, a); }
template<class T>
ostream& operator<<(ostream& s, multiset<T> const& a) { return print_collection(s, a); }
template<class T, class U>
ostream& operator<<(ostream& s, map<T, U> const& a) { return print_collection(s, a); }
template<class T>
ostream& operator<<(ostream& s, set<T> const& a) { return print_collection(s, a); }

template<class T>
ostream& print_collection(ostream& s, T const& a){
  s << '[';
  for(auto it = begin(a); it != end(a); ++it){
    s << *it;
    if(it != prev(end(a))) s << " ";
  }
  return s << ']';
}

template<class... A>
ostream& operator<<(ostream& s, tpl<A...> const& a){
  s << '(';
  print_tuple(s, a, my_index_sequence_for<A...>{});
  return s << ')';
}

template<class... A>
ostream& operator<<(ostream& s, tuple<A...> const& a){
  s << '(';
  print_tuple(s, a, my_index_sequence_for<A...>{});
  return s << ')';
}

template<class A, class B>
ostream& operator<<(ostream& s, pair<A, B> const& a){
  return s << "(" << get<0>(a) << ", " << get<1>(a) << ")";
}

//------------------------------------------------------------------------------

void readii(pii& p) { cin>>p.x()>>p.y(); }

using rational = double;
const rational EPS = 1e-6;

// struct rational {
//   rational() : x(0),y(1){ }
//   rational(lli a) : x(a), y(1){}
//   rational(lli a, lli b) {
//     lli g = __gcd(a,b);
//     a/=g; b/=g;
//     if(b<0) { a*=-1; b*=-1; }
//     x=a; y=b;
//   }
//   rational operator+(rational const& b) const {
//     return rational(x*b.y+y*b.x,y*b.y);
//   }
//   rational operator-(rational const& b) const {
//     return rational(x*b.y-y*b.x,y*b.y);
//   }
//   rational operator*(rational const& b) const {
//     return rational(x*b.x,y*b.y);
//   }
//   rational operator/(rational const& b) const {
//     return rational(x*b.y,y*b.x);
//   }
//   bool operator<(rational const& o) const {
//     return x*o.y<o.x*y;
//   }
//   bool operator<=(rational const& o) const {
//     return x*o.y<=o.x*y;
//   }

//   long double dbl() const { return (long double)x/(long double)y; }
//   lli x,y;
// };
// const rational EPS(0,1);

// ostream& operator<<(ostream& s, rational const& r) {
//   return s << r.x << "/" << r.y;
// }

// --- BEGIN SNIPPET TREAP ---

// struct treap;
// using treap_ptr = treap*;

// struct treap {
//   treap(rational x_, lli y_) : l(0), r(0), heap(rand()), x(x_), y(y_), sum(y) { }
//   treap_ptr l, r;
//   lli heap;

//   rational x;
//   lli y,sum;

//   static lli get_sum(treap_ptr a){ return a?a->sum:0; }

//   static void update(treap_ptr a){
//     if(a){
//       a->sum = a->y;
//       if(a->l) a->sum += a->l->sum;
//       if(a->r) a->sum += a->r->sum;
//     }
//   }

//   static void push(treap_ptr){ }

//   static treap_ptr merge(treap_ptr a, treap_ptr b){
//     if(a == 0) return b;
//     if(b == 0) return a;
//     push(a); push(b);
//     if(a->heap < b->heap){
//       a->r = merge(a->r, b);
//       update(a);
//       return a;
//     }else{
//       b->l = merge(a, b->l);
//       update(b);
//       return b;
//     }
//   }

//   static tpl<treap_ptr, treap_ptr> split_key(treap_ptr a, rational x){
//     if(a == 0) return mt(nullptr, nullptr);
//     push(a);
//     if(x <= a->x){
//       auto p = split_key(a->l, x);
//       a->l = p.y();
//       update(a);
//       return mt(p.x(), a);
//     }else{
//       auto p = split_key(a->r, x);
//       a->r = p.x();
//       update(a);
//       return mt(a, p.y());
//     }
//   }

//   // static tpl<treap_ptr, treap_ptr> split_pos(treap_ptr a, lli i){
//   //   if(a == 0) return mt(nullptr, nullptr);
//   //   push(a);
//   //   if(i <= get_size(a->l)){
//   //     auto p = split_pos(a->l, i);
//   //     a->l = p.y();
//   //     update(a);
//   //     return mt(p.x(), a);
//   //   }else{
//   //     auto p = split_pos(a->r, i - get_size(a->l) - 1);
//   //     a->r = p.x();
//   //     update(a);
//   //     return mt(a, p.y());
//   //   }
//   // }

//   static treap_ptr insert_key(treap_ptr a, rational x, lli y){
//     auto p = split_key(a, x);
//     return merge(merge(p.x(), new treap(x,y)), p.y());
//   }

//   // static treap_ptr insert_pos(treap_ptr a, lli i, rational x, lli y){
//   //   auto p = split_pos(a, i);
//   //   return merge(merge(p.x(), new treap(x,y)), p.y());
//   // }
// };

// --- END SNIPPET TREAP ---

// --- BEGIN SNIPPET BINARY INDEXED TREE ---

struct BIT {
  vi A;
  BIT(lli n) : A(n+1){ }

  lli get(lli i){
    if(i<0) return 0;
    i += 1;
    lli r = 0;
    for(; i > 0; i -= i &-i){
      r += A[i];
    }
    return r;
  }

  lli getR(lli l, lli r) {
    lli ans = get(r);
    if(l) ans -= get(l-1);
    return ans;
  }

  void add(lli i, lli v){
    if(i<0) return;
    i += 1;
    for(; i < (lli)A.size(); i += i & -i){
      A[i] += v;
    }
  }
};

// --- END SNIPPET BINARY INDEXED TREE ---

const int N = 100000;
pii F[N];
lli A[N];
pii Q[N];
lli T[N];
lli ANS[N];

template<class T>
tpl<T,T> operator+(tpl<T,T> const& a, tpl<T,T> const& b) {
  return tpl<T,T>(a.x()+b.x(),a.y()+b.y());
}

template<class T>
tpl<T,T> operator-(tpl<T,T> const& a, tpl<T,T> const& b) {
  return tpl<T,T>(a.x()-b.x(),a.y()-b.y());
}

template<class T>
T dot(tpl<T,T> const& a, tpl<T,T> const& b) {
  return a.x()*b.x()+a.y()*b.y();
}

template<class T>
T det(tpl<T,T> const& a, tpl<T,T> const& b) {
  return a.x()*b.y()-a.y()*b.x();
}

int main(){
  ios::sync_with_stdio(0); cin.tie(0);
  int k,n,q; cin>>k>>n>>q;
  vector<tpl<rational,rational>> P;
  { vector<tpl<rational,rational>> P2;
    FOR(i,k) {
      lli x,y; cin>>x>>y;
      P2.pb(tpl<rational,rational>(2*x,2*y));
      P2.pb(tpl<rational,rational>(-2*x,-2*y));
    }
    // sort(all(P2), [&](auto const& a, auto const& b) { return atan2(a.y().dbl(),a.x().dbl())<atan2(b.y().dbl(),b.x().dbl()); });
    sort(all(P2), [&](auto const& a, auto const& b) { return atan2(a.y(),a.x())<atan2(b.y(),b.x()); });
    P.pb(mt(0,0));
    FOR(i,2*k-1) P.pb(P.back() + P2[i]);
    tpl<rational,rational> center;
    FOR(i,2*k) center = center + P[i];
    center.x() = center.x()/rational(P.size()); center.y() = center.y()/rational(P.size());
    FOR(i,2*k) P[i] = P[i] - center;
  }
  //
  FOR(i,n) {
    readii(F[i]); cin>>A[i];
  }
  FOR(i,q) {
    readii(Q[i]); cin>>T[i];
  }
  //
  FOR(k_,2*k) {
    auto p0 = P[k_], p1 = P[(k_+1)%(2*k)];
    // cerr << "# " << mt(p0,p1) << endl;
    auto dt = det(p0,p1);
    // cerr << "Points: " << endl;
    vector<tpl<rational,rational,rational,lli>> pts;
    vector<tpl<rational,rational,rational,lli>> qs;
    vector<tpl<rational,rational,lli>> pts2;
    vector<tpl<rational,rational,lli>> qs2;
    set<double> as,bs;
    FOR(i,n) {
      rational a = (p1.y() * F[i].x() - p1.x() * F[i].y()) / dt;
      rational b = (p0.x() * F[i].y() - p0.y() * F[i].x()) / dt;
      // cout << dt << " " << mt(a,b) << endl;
      // cout << a*p0.x()+b*p1.x() << " " << F[i].x() << endl;;
      // cout << a*p0.y()+b*p1.y() << " " << F[i].y() << endl;;
      as.insert(a); bs.insert(b);
      pts.pb(mt(a+b,a,b,A[i]));
      pts2.pb(mt(a,b,A[i]));
      //cerr << mt(a,b,A[i]) << endl;
    }
    //cerr << "Queries: " << endl;
    FOR(i,q) {
      rational a = (p1.y() * Q[i].x() - p1.x() * Q[i].y()) / dt;
      rational b = (p0.x() * Q[i].y() - p0.y() * Q[i].x()) / dt;
      as.insert(a); bs.insert(b);
      qs.pb(mt(a+b+T[i],a,b,i));
      qs2.pb(mt(a,b,i));
      //cerr << mt(a,b,T[i]) << endl;
    }
    vector<double> vas(all(as)),vbs(all(bs));
    unordered_map<double,int> ias,ibs;
    FOR(i,vas.size()) ias[vas[i]]=i;
    FOR(i,vbs.size()) ibs[vbs[i]]=i;
    // Sweep 1
    sort(all(pts)); sort(all(qs));
    // cerr << pts << endl;
    int pts_i = 0;
    lli allV = 0;
    // treap_ptr ta=0,tb=0;
    BIT ta(vas.size()+1), tb(vbs.size()+1);
    for(auto const& ev : qs) {
      rational ab,a,b; lli i; tie(ab,a,b,i) = ev;
      // cerr << "Q " << ev << endl;
      while(pts_i<(int)pts.size() && pts[pts_i].x() <= ab+EPS) {
        rational a,b; lli x; tie(ignore,a,b,x) = pts[pts_i];
        // cerr << "P " << pts[pts_i] << endl;
        ta.add(ias[a],x);
        tb.add(ibs[b],x);
        // ta = treap::insert_key(ta,a,x);
        // tb = treap::insert_key(tb,b,x);
        allV += x;
        pts_i++;
      }
      ANS[i] += allV;
      ANS[i] -= ta.get(ias[a]);
      ANS[i] -= tb.get(ibs[b]-1);
      // { auto p = treap::split_key(ta,a+EPS);
      //   ANS[i] -= treap::get_sum(p.x());
      //   ta = treap::merge(p.x(),p.y());
      // }
      // { auto p = treap::split_key(tb,b-EPS);
      //   ANS[i] -= treap::get_sum(p.x());
      //   tb = treap::merge(p.x(),p.y());
      // }
    }
    // Sweep 2
    sort(all(pts2)); sort(all(qs2));
    pts_i = 0;
    // treap_ptr ts=0;
    BIT ts(vbs.size()+1);
    for(auto const& ev : qs2) {
      rational a,b; lli i; tie(a,b,i) = ev;
      while(pts_i<(int)pts2.size() && pts2[pts_i].x() <= a+EPS) {
        rational b; lli x; tie(ignore,b,x) = pts2[pts_i];
        ts.add(ibs[b],x);
        // ts = treap::insert_key(ts,b,x);
        pts_i++;
      }
      ANS[i] += ts.get(ibs[b]-1);
      // { auto p = treap::split_key(ts,b-EPS);
      //   ANS[i] += treap::get_sum(p.x());
      //   tb = treap::merge(p.x(),p.y());
      // }
    }
    // FOR(i,q) cout << ANS[i] << ' '; cout << endl;
    // FOR(i,q) ANS[i]=0;
  }
  //
  FOR(i,q) cout << ANS[i] << '\n';
  cout << flush;
  return 0;
}