#include <bits/stdc++.h>
double const PI = 4 * atan(1.0);
using namespace std;
void OPEN() {
  freopen("A.in", "r", stdin);
  freopen("A.out", "w", stdout);
}
string s;
int n, a;
pair<long long, long long> V[1001];
int t;
long long p[1001];
int main() {
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> V[i].second >> V[i].first;
  }
  cin >> t;
  for (int i = 0; i < t; i++) cin >> p[i + 1];
  p[t + 1] = 1ll << 44;
  p[0] = 0;
  sort(V, V + n);
  long long res = 0, j = 0, num = 0, the;
  for (int i = 1; i <= t + 1; i++) {
    for (; j < n; j++) {
      the = num + V[j].second;
      if (the >= p[i]) {
        V[j].second = V[j].second - (p[i] - num);
        res += (p[i] - num) * V[j].first * i;
        num = p[i];
        break;
      } else {
        res += (the - num) * V[j].first * i;
        num = the;
      }
    }
  }
  cout << res;
}
