#include <bits/stdc++.h>
using namespace std;
int n, t;
long long p[111];
pair<long long, long long> a[111], b[111];
long long ans;
int main() {
  cin >> n;
  for (int i = 0; i < n; i++) cin >> a[i].second >> a[i].first;
  long long last = 0, x;
  cin >> t;
  for (int i = 0; i < t; i++) {
    cin >> x;
    p[i + 1] = x - last;
    last = x;
  }
  p[t + 1] = 1LL << 60;
  sort(a, a + n);
  int j = 1, i = 0;
  while (i < n) {
    long long active = min(p[j], a[i].second);
    ans += active * a[i].first * j;
    p[j] -= active;
    a[i].second -= active;
    if (!p[j]) j++;
    if (!a[i].second) i++;
  }
  cout << ans << endl;
}
