#include <bits/stdc++.h>
using namespace std;
int n, t;
long long p[200];
struct Point {
  int x, y;
} a[200];
bool cmp(const Point &a, const Point &b) { return a.y < b.y; }
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; ++i) scanf("%d%d", &a[i].x, &a[i].y);
  sort(a + 1, a + n + 1, cmp);
  scanf("%d", &t);
  for (int i = 1; i <= t; ++i) cin >> p[i];
  p[t + 1] = (long long)(1) << 60;
  int k = 1;
  long long sum = 0, kk = 0;
  for (int i = 1; i <= n; ++i) {
    if (p[k] - kk <= a[i].x) {
      sum += (p[k] - kk) * k * a[i].y;
      a[i].x -= p[k] - kk;
      kk = p[k];
      k++;
      i--;
    } else {
      sum += (long long)a[i].x * k * a[i].y;
      kk += a[i].x;
      a[i].x = 0;
    }
  }
  cout << sum << endl;
  return 0;
}
