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