#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <numeric>
#include <string>
#include <cstdio>
#include <cstring>
#include <queue>
#include <stack>
#include <set>
#include <cmath>
#include <bitset>
#include <iomanip> 
#include <unordered_set>
#include <unordered_map>

using namespace std;

using ll = long long;
using ull = unsigned long long;

#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(int i = 0;(i) < ((int)(n));++(i))
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() )
#define test(a) cout<<"line:"<<__LINE__<<"["<<(#a)<<": "<<(a)<<"]"<<endl

constexpr int INF = 1e9+7;
constexpr ll INFL = 9*1e18;

constexpr int dx[4] = { 1, 0, -1, 0 };
constexpr int dy[4] = { 0, 1, 0, -1 };

// constexpr int dx[8] = {1, 1, 0,-1,-1,-1, 0, 1};
// constexpr int dy[8] = {0, 1, 1, 1, 0,-1,-1,-1};

int inline digit(ll num){int tmp = 0;while(num){tmp++;num/=10;}return tmp;} // 桁数
ull inline power(ull a,ull b){ull res = 1;rep(i,b)res *= a;return res;}
template<typename T>inline T SUM(vector<T> vec){return accumulate(all(vec),(T)0);} // vectorの中身を全部足す
template<typename T>inline T digitSum(T num){T sum = 0;while(num){sum+=num%10;num/=10;}return sum;} // 各桁の和
template<typename T>inline T gcd(T a,T b){if(b == 0)return a;return gcd(b,a%b);} // 最大公約数
template<typename T>inline T lcm(T a, T b){T g = gcd(a,b);return a/g*b;} // 最小公倍数
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<typename T>inline void print(T&& x){cout<<setprecision(32)<<x<<endl;}
string to_oct(int n){string s;while(n){s = to_string(n%8) + s;n /= 8;}return s;}

int main(){
  int n,m,q;cin>>n>>m>>q;
  vector<pair<int,int>> vw(n);rep(i,n)cin>>vw[i].se>>vw[i].fi;
  vector<int> x(m);rep(i,m)cin>>x[i];
  vector<int> a;
  sort(all(vw),greater<pair<int,int>>());
  

  rep(_,q){
    int l,r;cin>>l>>r;l--;r--;
    vector<int> boxes;
    rep(i,m){
      if(l <= i && i <= r)continue;
      boxes.push_back(x[i]);
    }
    sort(all(boxes));
    int ans = 0;
    rep(i,n){
      for(auto&& box: boxes){
        if(vw[i].second <= box){
          ans += vw[i].first;
          box = -1;
          break;
        }
      }
    }
    a.push_back(ans);
  }
  for(auto&& one: a){
    print(one);
  }
  return 0;
}
#include<bits/stdc++.h>
using namespace std;
#define  fast()      ios :: sync_with_stdio(false); cin.tie(0);
#define  ll             long long int
#define  ull            unsigned long long int
#define vl              vector<long long>
#define vc              vector<char>
#define vs              vector<string>
#define vp              vector< pair<ll,ll> >
#define sl              set<long long>
#define sc              set<char>
#define sts             stack<string>
#define max_3(a,b,c)    max(a, max(b,c))
#define max_4(a,b,c,d)  max(a,max(b,max(c,d)))
#define min_3(a,b,c)    min(a, min(b,c))
#define min_4(a,b,c,d)  min(a,min(b,min(c,d)))
#define gcd(a,b)        __gcd(a,b)
#define lcm(a,b)        (a*b)/gcd(a,b)
#define pi              2*acos(0.0)
#define N               200006
#define      mnn                 10000000000000
#define      mxx                 -10000000000000
#define in              1234567890;
ll a[N],b[N];
int M=1000000007;
map<ll,ll>mp,mk;
sl s1,s2;
vl v;
vl w,w1,w2,w3;
ll m,n,c,d,i,j,k,l,r,x,t,y,u,e,f,g,mn,mx,z;
string s,q,p;
char ch,ck;
int main()
{
    fast()
    t==1;
    cin>>s>>p;
    for(i=0;i<s.size();i++) c+=s[i]-'0';
    for(i=0;i<p.size();i++) d+=p[i]-'0';
    cout<<max(c,d);
}
