#include <bits/stdc++.h>

using namespace std;
using pii = pair<int, int>; // <value, weight>

int main() {
  bool box_state[50];

  int n, m, q;
  cin >> n >> m >> q;

  vector<pii> ni;
  vector<pii> ni_copy;
  for (int i = 0; i < n; i++) {
    int w, v;
    cin >> w >> v;
    ni.push_back(make_pair(v, w));
    ni_copy.push_back(make_pair(v, w));
  }
  sort(ni.begin(), ni.end()); // 後ろ（大きいほう）から出していく
  sort(ni_copy.begin(), ni_copy.end());

  vector<int> box_size_tmp(m), box_size;
  for (int& e : box_size_tmp) cin >> e;
  for (int k = 0; k < q; k++) {
    int from, to;
    cin >> from >> to;

    // 初期化部分
    for (int j = 0; j < 50; j++) box_state[j] = true;
    for (int j = from - 1; j < to; j++) {
      box_state[j] = false;
    }
    box_size.clear();
    ni.resize(ni_copy.size());

    for (int j = 0; j < (int)ni_copy.size(); j++) ni[j] = ni_copy[j];
    for (int j = 0; j < m; j++) {
      if (box_state[j]) box_size.push_back(box_size_tmp[j]);
    }
    sort(box_size.begin(), box_size.end());

    int sum_value = 0;
    while (!ni.empty() && !box_size.empty()) {
      pii tmp = ni[(int)ni.size() - 1];
      int value = tmp.first, weight = tmp.second;
      if (weight <= box_size[(int)box_size.size() - 1]) {
        for (int i = 0; i < (int)box_size.size(); i++) {
          if (box_size[i] >= weight) {
            sum_value += value;

            // cout << "a" << box_size.size() << "b" << endl;
            box_size.erase(box_size.begin() + i);
            break;
          }
        }
      }
      ni.pop_back();
    }
    cout << sum_value << endl;
  }
}
#include <bits/stdc++.h>
#include <string>
#define MAX 100007
#define scn1(a) scanf("%d", &a);
#define scn2(a, b) scanf("%d %d", &a, &b);
#define scn3(a, b, c) scanf("%d %d %d", &a, &b, &c);
#define lscn1(a) scanf("%lli", &a);
#define lscn2(a, b) scanf("%lli %lli", &a, &b);
#define lscn3(a, b, c) scanf("%lli %lli %lli", &a, &b, &c);
#define prnt(a) printf("%d\n", a);
#define forr(i, a, n) for(int i=a;i<n;i++)
#define nl puts("");
#define PB push_back
#define enl cout << "\n";
#define CHK(a) cout << (#a) << " = " << (a) << endl;
typedef long long int ll;
using namespace std;
void arraychk(int a[],int n) {for(int i=0;i<n;i++)cout<<a[i]<<" ";enl;}
#define LOOPCHK(a, n) arraychk(a, n);

int main()
{
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    ll tt=1;
    // cin >> tt;
    for(int cse=1; cse<=tt; cse++)
    {
        int n=0, x=0, y=0, ans=0, sum=0;
        
        cin >> n;
        double a[n], b[n];
        forr(i, 0, n)
            cin >> a[i] >> b[i];
        forr(i, 0, n)
        {
            forr(j, i+1, n)
            {
                if( ((b[j]-b[i])/(a[j]-a[i]))<=1 && ((b[j]-b[i])/(a[j]-a[i]))>=-1 )
                {
                    ans++;
                }
            }
        }
        // cout << "Case " << cse <<  ":";
        cout << ans << endl;
    }
    return 0;
}
