#include <bits/stdc++.h>
using namespace std;
struct __INIT
{
    __INIT()
    {
        cin.tie(0);
        ios::sync_with_stdio(false);
        cout << fixed << setprecision(15);
    }
} __init;
#define max3(a, b, c) max(a, max(b, c))
#define min3(a, b, c) min(a, min(b, c))
//#define INF (1<<30)
#define LINF (lint)(1LL << 56)
#define endl "\n"
#define rep(i, n) for (lint(i) = 0; (i) < (n); (i)++)
#define reprev(i, n) for (lint(i) = (n - 1); (i) >= 0; (i)--)
#define flc(x) __builtin_popcountll(x)
#define pint pair<int, int>
#define pdouble pair<double, double>
#define plint pair<lint, lint>
#define fi first
#define se second
#define all(x) x.begin(), x.end()
#define vec vector<lint>
#define nep(x) next_permutation(all(x))
typedef long long lint;
int dx[8] = {1, 1, 0, -1, -1, -1, 0, 1};
int dy[8] = {0, 1, 1, 1, 0, -1, -1, -1};
const int MAX_N = 3e5 + 5;
constexpr int MOD = 1000000007;
typedef __int128_t llint;

int main(void)
{
    int N, M, Q;
    cin >> N >> M >> Q;
    pint itm[N];
    rep(i, N) cin >> itm[i].se >> itm[i].fi;
    sort(itm, itm + N, greater<pint>());
    int X[M];
    rep(i, M) cin >> X[i];
    while (Q--)
    {
        int L, R;
        cin >> L >> R;
        L--, R--;
        vector<int> box;
        rep(i, M) if (i < L || i > R) box.push_back(X[i]);
        sort(all(box));
        int ans = 0;
        rep(i, N)
        {
            rep(j, box.size())
            {
                if (itm[i].se <= box[j])
                {
                    ans += itm[i].fi, box[j] = 0;
                    break;
                }
            }
        }
        cout << ans << endl;
    }
}
#include<bits/stdc++.h> //Ithea Myse Valgulious
namespace chtholly{
typedef long long ll;
#define re0 register int
#define rel register ll
#define rec register char
#define gc getchar
// #define gc() (p1==p2&&(p2=(p1=buf)+fread(buf,1,1<<23,stdin),p1==p2)?-1:*p1++)
#define pc putchar
#define p32 pc(' ')
#define pl puts("")
/*By Citrus*/
char buf[1<<23],*p1=buf,*p2=buf;
inline int read(){
  int x=0,f=1;char c=gc();
  for (;!isdigit(c);c=gc()) f^=c=='-';
  for (;isdigit(c);c=gc()) x=(x<<3)+(x<<1)+(c^'0');
  return f?x:-x;
  }
template <typename mitsuha>
inline bool read(mitsuha &x){
  x=0;int f=1;char c=gc();
  for (;!isdigit(c)&&~c;c=gc()) f^=c=='-';
  if (!~c) return 0;
  for (;isdigit(c);c=gc()) x=(x<<3)+(x<<1)+(c^'0');
  return x=f?x:-x,1;
  }
template <typename mitsuha>
inline int write(mitsuha x){
  if (!x) return 0&pc(48);
  if (x<0) pc('-'),x=-x;
  int bit[20],i,p=0;
  for (;x;x/=10) bit[++p]=x%10;
  for (i=p;i;--i) pc(bit[i]+48);
  return 0;
  }
inline char fuhao(){
  char c=gc();
  for (;isspace(c);c=gc());
  return c;
  }
}using namespace chtholly;
using namespace std;
const int yuzu=2e5;
typedef int fuko[yuzu|10];
fuko a,b;
int main() {
  int i,n,m,c1,c2,j;
  read(n),read(m);
  for (i=1;i<=n;++i) a[i]=read();
  for (i=1;i<=m;++i) b[i]=read();
  for (i=1;i<=1e3;++i) {
    c1=c2=0;
    for (j=1;j<=n;++j) c1+=a[j]==i;
    for (j=1;j<=m;++j) c2+=b[j]==i;
    !c1&&c2||!c2&&c1?printf("%d ",i):0;
  }
}