#include <bits/stdc++.h>
using namespace std;
const long long MAXN = 1e2 + 7;
long long p[MAXN], dp[MAXN];
pair<long long, long long> fig[MAXN];
int32_t main() {
  long long n;
  cin >> n;
  for (long long i = 0; i < n; ++i) cin >> fig[i].second >> fig[i].first;
  sort(fig, fig + n);
  long long t;
  cin >> t;
  for (long long i = 1; i <= t; ++i) cin >> p[i];
  p[t + 1] = (1LL << 60);
  long long pos = 1, ans = 0, sum = 0;
  for (long long i = 0; i < n; ++i) {
    while (fig[i].second) {
      if (p[pos] - sum > fig[i].second) {
        sum += fig[i].second;
        ans += fig[i].second * pos * fig[i].first;
        fig[i].second = 0;
      } else {
        ans += fig[i].first * (p[pos] - sum) * pos;
        fig[i].second -= p[pos] - sum;
        sum = p[pos];
        pos++;
      }
    }
  }
  cout << ans << "\n";
}
