#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
using ll = long long;
using pii = pair<int, int>;

int main() {
  int n, m, x;
  cin >> n >> m >> x;
  vector<vector<int>> v(m);
  rep(i, n) {
    int a, b;
    cin >> a >> b;
    v[b - 1].push_back(a);
  }
  rep(i, m) {
    sort(v[i].rbegin(), v[i].rend());
    v[i].front() += x;
  }
  vector<int> t;
  rep(i, m) for (auto a : v[i]) t.push_back(a);
  sort(t.rbegin(), t.rend());
  vector<ll> s(n + 1);
  rep(i, n) s[i + 1] += s[i] + t[i];
  int k;
  cin >> k;
  ll ans = 0;
  rep(i, k) {
    int c;
    cin >> c;
    ans += s[c];
  }
  cout << ans << endl;
  return 0;
}