#include <bits/stdc++.h>
using namespace std;
struct v {
  long long k;
  long long c;
} num[110];
struct P {
  long long num;
  int cnt;
} p[110];
bool cmp(v A, v B) { return A.c < B.c; }
int main() {
  int m, n, t, q, flag;
  long long ss, sum;
  while (~scanf("%d", &n)) {
    memset(num, 0, sizeof(num));
    memset(p, 0, sizeof(p));
    num[0].k = 0;
    num[0].c = 0;
    for (int i = 1; i <= n; i++) cin >> num[i].k >> num[i].c;
    scanf("%d", &t);
    p[0].num = 0;
    p[0].cnt = 0;
    for (int i = 1; i <= t; i++) {
      cin >> p[i].num;
      if (p[i].num != p[i - 1].num)
        p[i].cnt = i;
      else
        p[i].cnt = p[i - 1].cnt;
    }
    sort(num + 1, num + n + 1, cmp);
    sum = 0;
    ss = 0;
    q = 1;
    flag = 1;
    for (int i = 1; i <= n; i++) {
      ss = ss + num[i].k;
      int j, l;
      for (j = 1; j <= t; j++)
        if (p[j].num >= ss) break;
      if (j <= t) {
        for (l = q; l <= j; l++) {
          if (q == j)
            sum = sum + num[i].k * (p[l - 1].cnt + 1) * num[i].c;
          else if (l == j)
            sum = sum + (ss - p[l - 1].num) * (p[l - 1].cnt + 1) * num[i].c;
          else if (l == q)
            sum = sum +
                  (p[l].num - (ss - num[i].k)) * (p[l - 1].cnt + 1) * num[i].c;
          else
            sum =
                sum + (p[l].num - p[l - 1].num) * (p[l - 1].cnt + 1) * num[i].c;
        }
      } else {
        for (l = q; l <= t; l++) {
          if (l == q)
            sum = sum +
                  (p[l].num - (ss - num[i].k)) * (p[l - 1].cnt + 1) * num[i].c;
          else
            sum =
                sum + (p[l].num - p[l - 1].num) * (p[l - 1].cnt + 1) * num[i].c;
        }
        if (flag == 1)
          sum = sum + (num[i].k - (p[t].num - ss + num[i].k)) * (p[t].cnt + 1) *
                          num[i].c;
        else
          sum = sum + (num[i].k) * (p[t].cnt + 1) * num[i].c;
        flag++;
        l++;
      }
      q = l - 1;
    }
    cout << sum << endl;
  }
  return 0;
}
