#include <bits/stdc++.h>
using namespace std;
int n;
pair<int, int> a[111];
int m;
long long p[111];
long long an;
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; ++i) scanf("%d%d", &a[i].second, &a[i].first);
  sort(a + 1, a + 1 + n);
  scanf("%d", &m);
  for (int i = 1; i <= m; ++i) scanf("%I64d", &p[i]);
  p[++m] = 1e12;
  long long cur = 0;
  int ps = 1;
  for (int i = 1; i <= n; ++i) {
    while (a[i].second) {
      if (cur + a[i].second > p[ps]) {
        a[i].second -= p[ps] - cur;
        an += 1ll * ps * (p[ps] - cur) * a[i].first;
        cur = p[ps++];
      } else {
        an += 1ll * a[i].second * ps * a[i].first;
        cur += a[i].second;
        a[i].second = 0;
      }
    }
  }
  printf("%I64d", an);
  return 0;
}
