#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef long double ld;
typedef vector<ll> vl;
typedef vector<bool> vb;
typedef vector<string> vs;
typedef vector<char> vc;
typedef queue<ll> ql;
typedef deque<ll> dql;
typedef priority_queue<ll> pql;
typedef set<ll> sl;
typedef pair<ll, ll> pl;
typedef map<ll, ll> ml;
typedef vector<vl> vvl;
typedef vector<pl> vpl;
#define rep(i, n) for(ll i = 0; i < ll(n); i++)
#define rep2(i, k, n) for(ll i = ll(k); i <= ll(n); i++)
#define rep3(i, n, k) for(ll i = ll(n); i >= ll(k); i--)
#define all(v) (v).begin(), (v).end()
ll mod(ll a, ll b) {return (a % b + b) % b;}
ll quo(ll a, ll b) {return (a - mod(a, b)) / b;}
template <typename T, typename U> bool chmin(T &a, const U b) {if(a > b) {a = b; return 1;} return 0;}
template <typename T, typename U> bool chmax(T &a, const U b) {if(a < b) {a = b; return 1;} return 0;}
const ll INF = 1LL << 60;
const ll MOD = 1e9 + 7;
//const ll MOD = 998244353;
const ll MAX = 2e5;
const ld eps = 1e-9;
const char newl = '\n';

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);

  ll n, k, x, y, z;
  cin >> n >> k;
  n--;
  vvl dp(4, vl(3*n+1)), sum = dp;
  dp[0][0] = 1;
  sum[0] = vl(3*n+1, 1);
  rep(i, 3) {
    sum[i+1][0] = 1; 
    rep(j, 3*n+1) {
      dp[i+1][j] = sum[i][j];
      if(j > n) dp[i+1][j] -= sum[i][j-n-1];
      if(j > 0) sum[i+1][j] = sum[i+1][j-1] + dp[i+1][j];
    }
  }
  ll d = -1, u = 3*n;
  while(u-d > 1) {
    ll m = (d+u)/2;
    if(k <= sum[3][m]) u = m;
    else d = m; 
  }
  if(u > 0) k -= sum[3][u-1];
  ll D = -1, U = n;
  while(U-D > 1) {
    ll M = (D+U)/2;
    if(k <= sum[2][u] - (u-M-1 >= 0 ? sum[2][u-M-1] : 0LL)) U = M;
    else D = M;
  }
  k -= (sum[2][u] - (u-U >= 0 ? sum[2][u-U] : 0LL));
  x = U;
  if(u-U <= n) y = k-1;
  else y = n - dp[2][u-U] + k;
  z = u-x-y;
  printf("%lld %lld %lld\n", x+1, y+1, z+1);
  return 0;
}
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using vl = vector<ll>;
using vll = vector<vl>;
using Pll = pair<ll, ll>;
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define Rep(i,j,n) for (ll i=(ll)(j);i<=(ll)(n);++i)
#define all(v) v.begin(), v.end()
#define sz(x) ((int) x.size())
#define eb emplace_back
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define F first
#define S second
const int MOD = 1e9+7;
const int mod = 998244353;
const ll INF = 2e15;
template<class T> void print(const T& t){ cout << t << endl; }
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; }
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}

/*
ll ti=clock();
cout<<("Execution Time: %.4lf sec", 1.0 * (clock() - ti) / CLOCKS_PER_SEC)<<endl;
*/

int main(){
  ll n,m,q;
  cin>>n>>m>>q;
  vl w(n),v(n);
  vector<Pll> bag;
  rep(i,n){
      cin>>w[i]>>v[i];
      bag.emplace_back(v[i],w[i]);
  }
  sort(all(bag),greater<Pll>());
  vl x(m);
  rep(i,m){
      cin>>x[i];
  }
  rep(i,q){
      ll l,r;
      cin>>l>>r;
      vl tmp;
      rep(i,m){
          if(i==l-1){
              i=r;
              if(r==m){
                  break;
              }
          }
          tmp.eb(x[i]);
      }
      sort(all(tmp));
      vector<bool> empty(sz(tmp),true);
      ll sum=0;
      rep(i,n){
          rep(j,sz(tmp)){
              if(bag[i].S<=tmp[j]&&empty[j]){
                  sum+=bag[i].F;
                  empty[j]=false;
                  break;
              }
          }
      }
      print(sum);
  }
}