#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define MEM(x,val) memset(x,val,sizeof(x))
#define LL long long
#define F first
#define S second
#define PI pair<int,int>
#define PLL pair<LL,LL>
#define ALL(x) x.begin(),x.end()

#define int LL
const int Mx = 300005;

int N,q;
int tree[Mx * 4];

void up(int node,int b,int e,int in,int val){
  if(in < b or in > e) return;
  if(b == e){
    tree[node] ^= val;
  }else{
    int mid = (b + e)/2;
    up(node*2,b,mid,in,val);
    up(node*2+1,mid+1,e,in,val);
    tree[node] = tree[node*2] ^ tree[node*2+1];
  }
}

int query(int node,int b,int e,int l,int r){
  if(l > e or r < b) return 0;
  if(b >= l and e <= r){
    return tree[node];
  }
  int mid = (b + e)/2;
  return query(node*2,b,mid,l,r) ^ query(node*2 + 1,mid+1,e,l,r);
}

void solve(){
  cin >> N >> q;
  for(int i = 1; i<=N; i++){
    int x; cin >> x;
    up(1,1,Mx-1,i,x);
  }

  while(q--){
    int ty; scanf("%lld",&ty);
    if(ty == 1){
      int x,y; scanf("%lld %lld",&x,&y);
      up(1,1,Mx-1,x,y);
    }else{
      int x,y; scanf("%lld %lld",&x,&y);
      //cout << x << ' ' << y << endl;
      printf("%lld\n",query(1,1,Mx-1,x,y));
    }
  }
}


int32_t main(){
 
  int tt; tt = 1;
  int cas = 1;
  while(tt--){
    //printf("Case %lld: ",cas++);
    solve();
  }
}

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

#define IO          ios_base :: sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define int         long long
#define double      long double
#define vi          vector<int>
#define vvi         vector<vi>
#define pii         pair<int, int>
#define vii         vector<pii>
#define endl        '\n'
#define pb          push_back
#define all(v)      (v).begin(), (v).end()
#define rall(v)     (v).rbegin(), (v).rend()
#define mod         1000000007

int n, m, q;

void solve() {
	cin >> n >> m >> q;
	vii bag(n);
	for (auto& it : bag) {
		cin >> it.first >> it.second;
	}
	vi box(m);
	for (auto& it : box) {
		cin >> it;
	}
	sort(all(bag));
	while (q--) {
		int l, r;
		cin >> l >> r;
		l--, r--;
		vi a;
		for (int i = 0; i < m; i++) {
			if (i < l || i > r) 
				a.pb(box[i]);
		}
		sort(all(a));
		multiset<int> memory;
		int idx = 0, ans = 0;
		for (auto& it : a) {
			while (idx < n && bag[idx].first <= it)	{
				memory.insert(bag[idx].second);
				idx++;
			}
			if (memory.size()) {
				ans += *memory.rbegin();
				memory.erase(prev(memory.end()));
			}
		}
		cout << ans << endl;
	}
}

signed main() {
	IO;
	int t = 1;
	// cin >> t;
	while (t--) {
		solve();
	}
	return 0;
}