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

int main() {
  ll N,M,X,Y; cin >> N >> M;
  vector<pair<ll,ll>> P;
  set<ll> A,B,S; S.insert(N);
  for (int i =0; i<M; i++) { cin >> X >> Y; P.push_back({X,Y});}
  sort(P.begin(),P.end()); 
  ll tmp = 0,cnt;
  while (tmp < M) {
    A.clear(); B.clear();
    cnt = tmp;
    while (cnt < M) {
      if (P[cnt].first == P[tmp].first) cnt++;
      else break; }
    for (int i =tmp; i<cnt; i++) {
      ll tmpY = P[i].second; 
      if (S.find(tmpY)==S.end()) {
        if (S.find(tmpY-1)!=S.end() || S.find(tmpY+1)!=S.end()) A.insert(tmpY);
      } else {
        if (S.find(tmpY-1)==S.end() && S.find(tmpY+1)==S.end()) B.insert(tmpY);
      }
    }
    for (auto x: A) S.insert(x);
    for (auto x: B) S.erase(x);
    tmp = cnt;
  }
  cout << S.size() << endl; 
  return 0;
}
#include<bits/stdc++.h>
using namespace std;
#define vec vector<int>
#define vecp vector<pair<int,int>>
#define ll long long
#define ull unsigned long long
#define pb push_back
#define fr first
#define sc second
#define fr1(i,a,b) for(int i=a;i<b;i++)
#define fr2(i,a,b) for(int i=a;i>=b;i--)
#define fr3(i,a,b) for(int i=a;i<=b;i++)
#define umap unordered_map<int,int,custom_hash>
#define omap map<int,int>
#define uset unordered_set<int,custom_hash>
#define oset set<int>
#define pr pair<int,int>
#define mod 1000000007
#define mp make_pair
#define all(v) v.begin(),v.end()
#define ppb pop_back

struct custom_hash {
    static uint64_t splitmix64(uint64_t x) {
        // http://xorshift.di.unimi.it/splitmix64.c
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }
    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};

void solve()
{
  int n,m,q;
  cin>>n>>m>>q;
  vecp v(n);
  fr1(i,0,n)cin>>v[i].sc>>v[i].fr;
  sort(all(v),greater<pair<int,int>>());
  vec box(m);
  fr1(i,0,m)cin>>box[i];
  fr1(i,0,q)
  {
    int l,r;
    cin>>l>>r;
    vec cap;
    fr1(i,0,m)
    {
      if(i>=l-1&&i<=r-1)continue;
        cap.pb(box[i]);
    }
    ll ans=0;
    vector<bool> var(cap.size(),true);
    fr1(i,0,n)
    {
      int val=INT_MAX,index1=-1,index2=-1;
      for(int j=0;j<cap.size();j++)
      {
        if(var[j]&&cap[j]>=v[i].sc&&cap[j]-v[i].sc<val)
        {
          val=cap[j]-v[i].sc;
          index1=j;
          index2=v[i].fr;
        }
      }
      if(index1>=0)
      {
        var[index1]=false;
        ans+=index2;
      }
    }
    cout<<ans<<"\n";
  }
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int t=1;
    //cin>>t;
    fr3(i,1,t){
      //cout<<"Case: "<<t<<;
        solve();
    }
   return 0;
}