#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pii;
#define MP make_pair
#define PB push_back
#define inf 1000000007
#define rep(i,n) for(int i = 0; i < (int)(n); ++i)
#define all(x) (x).begin(),(x).end()

template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}
 
template<class T> inline bool chmax(T &a, T b){
    if(a<b){
        a = b;
        return true;
    }
    return false;
}

template<class T> inline bool chmin(T &a, T b){
    if(a>b){
        a = b;
        return true;
    }
    return false;
}

class RangeMexQuery {
private:
    int n, m;
    vector<array<int, 3> > ptr;
    vector<int> arr, st;
    int update(const int prv, const int id, const int val, const int l, const int r){
        const int cur = (int)ptr.size();
        ptr.push_back({0, 0, id});
        if(r - l == 1) return cur;
        const int mid = (l + r) / 2;
        if(val < mid){
            const int res = update(ptr[prv][0], id, val, l, mid);
            ptr[cur][0] = res, ptr[cur][1] = ptr[prv][1];
        }else{
            const int res = update(ptr[prv][1], id, val, mid, r);
            ptr[cur][0] = ptr[prv][0], ptr[cur][1] = res;
        }
        ptr[cur][2] = min(ptr[ptr[cur][0]][2], ptr[ptr[cur][1]][2]);
        return cur;
    }
    void preprocessing(const vector<int>& vec){
        arr[0] = 0;
        for(int i = 0; i < n; ++i) arr[2 * i + 1] = vec[i], arr[2 * i + 2] = vec[i] + 1;
        sort(arr.begin(), arr.end());
        arr.erase(unique(arr.begin(), arr.end()), arr.end());
        m = (int)arr.size(), st[0] = 0, ptr.push_back({0, 0, -1});
        for(int i = 0; i < n; ++i){
            const int val = (int)(lower_bound(arr.begin(), arr.end(), vec[i]) - arr.begin());
            st[i + 1] = update(st[i], i, val, 0, m);
        }
    }
    int query(const int cur, const int cri, const int l, const int r){
        if(cur == 0 || r - l == 1) return arr[l];
        const int mid = (l + r) / 2;
        if(ptr[ptr[cur][0]][2] < cri) return query(ptr[cur][0], cri, l, mid);
        else return query(ptr[cur][1], cri, mid, r);
    }
public:
    RangeMexQuery(const vector<int>& vec) : n((int)vec.size()), arr(2 * n + 1), st(n + 1){
        preprocessing(vec);
    }
    int query(const int l, const int r){
        return query(st[r], l, 0, m);
    }
};

int main(){
    int n,m;
    cin >> n >> m;
    vector<int> a(n);
    rep(i,n) cin >> a[i];
    RangeMexQuery rmq(a);
    int mi = inf;
    rep(i,n-m+1){
        chmin(mi,rmq.query(i,i+m));
    }
    cout << mi << endl;
    return 0;
}
#include <bits/stdc++.h>
#include <unordered_set>
#include <cmath>

// URL: https://atcoder.jp/contests/abc195/tasks/abc195_d

using namespace std;

using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vi = vector<int>;
using vll = vector<ll>;
using vs = vector<string>;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define reps(i, s, n) for (int i = (int)(s); i < (int)(n); i++)

#define repll(i, n) for (ll i = 0; i < (ll)(n); i++)
#define repsll(i, s, n) for (ll i = (ll)(s); i < (ll)(n); i++)

#define ALL(a) (a).begin(), (a).end()

#define pb push_back
#define optimize_cin() cin.tie(0); ios::sync_with_stdio(false)

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

const ll INFL = 1e18;
const int INF = 1e9;



int main(){
  optimize_cin();

  ll N, M, Q;
  cin >> N >> M >> Q;

  //vector<pll> WV(N);
  //vll W(N), V(N);
  vector<pll> VW(N);
  vll X(M), L(Q), R(Q);

  rep(i, N){
  ll W, V;
  // cin >> W[i] >> V[i];
  cin >> W >> V;
  VW[i] = make_pair(V, W);
  // WV[i].first() = W;
  // WV[i].second() = V;
  } 
  rep(i, M) cin >> X[i];
  rep(i, Q) cin >> L[i] >> R[i];

  sort(ALL(VW));
  reverse(ALL(VW));

  // ll max = 0;

  rep(i, Q) {
  vector<bool> box(M, true);
  for(int j = L[i] - 1; j <= R[i] - 1; j++){
  box[j] = false;
  }
  vll avail;
  rep(j, M){
  if(box[j]){
  avail.pb(X[j]);
  }
  }
  sort(ALL(avail));
  // reverse(ALL(avail));
  vll used(avail.size(), false);
  int cnt = avail.size();
  ll max = 0;
  rep(j, N)
  {
  rep(k, avail.size()){
  if(cnt > 0 && !used[k] && VW[j].second <= avail[k]){
  max += VW[j].first; 
  used[k] = true;
  cnt--;
  break;
  }
  }
  }
  cout << max << endl;

}




  return 0;
}