#include <bits/stdc++.h>
using namespace std;
const int INF = 0x3f3f3f3f;
const double eps = 1E-8;
struct P {
  long long num, val;
} p[110];
long long f[110];
long long factor;
long long ans;
int n, t;
bool cmp(const P& a, const P& b) {
  if (a.val == b.val) return a.num > b.num;
  return a.val < b.val;
}
int main() {
  while (cin >> n) {
    (memset(p, 0, sizeof(p)));
    for (int i = 1; i <= n; i++) cin >> p[i].num >> p[i].val;
    cin >> t;
    for (int i = 1; i <= t; i++) cin >> f[i];
    for (int i = t; i >= 2; i--) f[i] = f[i] - f[i - 1];
    sort(p + 1, p + 1 + n, cmp);
    int curfpos = 1;
    factor = 1;
    ans = 0;
    for (int i = 1; i <= n;) {
      long long num = min(f[curfpos], p[i].num);
      if (curfpos > t) {
        ans += factor * p[i].num * p[i].val;
        i++;
        continue;
      }
      ans += factor * num * p[i].val;
      f[curfpos] -= num;
      p[i].num -= num;
      if (f[curfpos] == 0 && curfpos <= t) {
        curfpos++;
        factor = curfpos;
      }
      if (p[i].num == 0) i++;
    }
    cout << ans << endl;
  }
  return 0;
}
