#include <bits/stdc++.h>
using namespace std;
template <class T>
T abs(T x) {
  return x > 0 ? x : -x;
}
int n;
int m;
long long p[101];
pair<int, int> v[100];
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; i++) scanf("%d%d", &v[i].second, &v[i].first);
  scanf("%d", &m);
  for (int i = 0; i < m; i++) scanf("%I64d", &p[i]);
  for (int i = m - 1; i > 0; i--) p[i] -= p[i - 1];
  p[m] = 1e18;
  sort(v, v + n);
  long long ans = 0;
  int i = 0, j = 0;
  while (i < n) {
    long long tmp = min((long long)v[i].second, p[j]);
    ans += (long long)v[i].first * tmp * (j + 1);
    v[i].second -= tmp;
    p[j] -= tmp;
    if (v[i].second == 0) i++;
    if (p[j] == 0) j++;
  }
  cout << ans << endl;
  return 0;
}
