#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
using ll = long long;
using P = pair<int, int>;

int main() {
    int n, m, q;
    cin >> n >> m >> q;

    vector<P> wv(n);
    rep(i, n) {
        int w, v;
        cin >> w >> v;
        wv[i] = {v, -w};
    }
    sort(wv.begin(), wv.end(), greater<>());
    vector<ll> x(m);
    rep(i, m) cin >> x[i];

    rep(i, q) {
        int l, r;
        cin >> l >> r;
        l--, r--;
        multiset<ll> s;
        rep(j, m) {
            if (j >= l && j <= r) continue;
            s.insert(x[j]);
        }

        ll res = 0;
        rep(j, n) {
            auto it = s.lower_bound(-wv[j].second);
            if (it == s.end()) continue;
            res += wv[j].first;
            s.erase(it);
        }
        cout << res << endl;
    }
}
#include <bits/stdc++.h>
#define MOD 1000000007LL
using namespace std;
typedef long long ll;
typedef pair<int,int> P;

class segtree{
public:
	static const int N=1<<18;
	ll dp[1<<19];
	segtree(){
		memset(dp,0,sizeof(dp));
	}
	void update(int k,ll v){
		k+=N-1;
		dp[k]+=v;
		while(k>0){
			k=(k-1)/2;
			dp[k]=dp[k*2+1]+dp[k*2+2];
		}
	}

	ll query(int a,int b,int k=0,int l=0,int r=N){
		if(b<=l || r<=a)return 0;
		if(a<=l && r<=b)return dp[k];
		int mid=(l+r)/2;
		ll vl=query(a,b,k*2+1,l,mid);
		ll vr=query(a,b,k*2+2,mid,r);
		return vl+vr;
	}
};

segtree sumx,cntx;
segtree sumy,cnty;
int n,m,q;
ll sum;
ll a[200005];
ll b[200005];
int t[200005],x[200005];
ll y[200005];
vector<ll> yi;

int main(void){
	scanf("%d%d%d",&n,&m,&q);
	cntx.update(0,n);
	cnty.update(0,m);
	yi.push_back(0);

	for(int i=0;i<q;i++){
		scanf("%d%d%lld",&t[i],&x[i],&y[i]);
		x[i]--;
		yi.push_back(y[i]);
	}
	sort(yi.begin(),yi.end());
	yi.erase(unique(yi.begin(),yi.end()),yi.end());

	for(int i=0;i<q;i++){
		int pos=lower_bound(yi.begin(),yi.end(),y[i])-yi.begin();
		if(t[i]==1){
			ll val_mi=sumy.query(a[x[i]],yi.size()+1);
			ll cnt_mi=cnty.query(0,a[x[i]]);
			sum-=cnt_mi*yi[a[x[i]]]+val_mi;
			sumx.update(a[x[i]],-yi[a[x[i]]]);
			cntx.update(a[x[i]],-1);
			a[x[i]]=pos;
			sumx.update(a[x[i]],yi[a[x[i]]]);
			cntx.update(a[x[i]],1);
			val_mi=sumy.query(a[x[i]],yi.size()+1);
			cnt_mi=cnty.query(0,a[x[i]]);
			sum+=cnt_mi*yi[a[x[i]]]+val_mi;
			//printf("%lld %lld\n",val_mi,cnt_mi);
		}else{
			ll val_mi=sumx.query(b[x[i]],yi.size()+1);
			ll cnt_mi=cntx.query(0,b[x[i]]);
			sum-=cnt_mi*yi[b[x[i]]]+val_mi;
			sumy.update(b[x[i]],-yi[b[x[i]]]);
			cnty.update(b[x[i]],-1);
			b[x[i]]=pos;
			sumy.update(b[x[i]],yi[b[x[i]]]);
			cnty.update(b[x[i]],1);
			val_mi=sumx.query(b[x[i]],yi.size()+1);
			cnt_mi=cntx.query(0,b[x[i]]);
			sum+=cnt_mi*yi[b[x[i]]]+val_mi;
		}
		printf("%lld\n",sum);
	}
	return 0;
}
