#include <bits/stdc++.h>
using namespace std;
const int MAXN = 111;
const long long MAXM = 1000000000111;
pair<long long, long long> item[MAXN];
long long p[MAXN];
int main() {
  int n, m;
  cin >> n;
  for (int i = 0; i < n; i++) cin >> item[i].second >> item[i].first;
  sort(item, item + n);
  cin >> m;
  long long psum = 0;
  for (int i = 0; i < m; i++) {
    cin >> p[i];
    p[i] -= psum;
    psum += p[i];
  }
  p[m] = MAXM;
  int k = 0;
  long long pk = 0;
  long long sum = 0;
  for (int i = 0; i < n; i++) {
    while (item[i].second > 0) {
      if (p[k] - pk <= item[i].second) {
        item[i].second -= p[k] - pk;
        sum += (item[i].first * (p[k] - pk) * (k + 1));
        pk = 0;
        k++;
      } else {
        pk += item[i].second;
        sum += (item[i].first * item[i].second * (k + 1));
        item[i].second = 0;
      }
    }
  }
  cout << sum << endl;
  return 0;
}
