#include <bits/stdc++.h>
using namespace std;
int main() {
  int m;
  cin >> m;
  vector<int> q(m);
  for (int i = 0; i < m; ++i) cin >> q[i];
  sort(q.begin(), q.end());
  reverse(q.begin(), q.end());
  int n;
  cin >> n;
  vector<int> a(n);
  for (int i = 0; i < n; ++i) cin >> a[i];
  sort(a.begin(), a.end());
  int ans = 0, pos = m - 1, ost = n;
  while (ost) {
    if (pos && q[pos] > ost) {
      --pos;
      continue;
    }
    if (!pos && q[pos] > ost) {
      for (int i = ost - 1; i >= 0; --i) ans += a[i];
      ost = 0;
      continue;
    }
    for (int i = 0; i < q[pos]; ++i) ans += a[ost - 1 - i];
    ost -= q[pos];
    ost -= min(2, ost);
  }
  cout << ans;
  return 0;
}
