#include <bits/stdc++.h>
using namespace std;
int main(int argc, char const *argv[]) {
  int m;
  cin >> m;
  std::vector<int> item(m);
  for (int i = 0; i < m; ++i) {
    scanf("%d", &item[i]);
  }
  sort(item.begin(), item.end());
  int n;
  cin >> n;
  std::vector<int> price(n);
  for (int i = 0; i < n; ++i) {
    scanf("%d", &price[i]);
  }
  sort(price.begin(), price.end());
  int itemsRemaining = n;
  int offer = 0;
  int cost = 0;
  while (itemsRemaining > 0) {
    if (itemsRemaining >= item[offer]) {
      for (int i = 0; i < item[offer]; ++i) {
        cost += price[itemsRemaining - i - 1];
      }
    } else {
      for (int i = 0; i < itemsRemaining; ++i) {
        cost += price[i];
      }
      break;
    }
    if (itemsRemaining >= item[offer] + 2) {
      itemsRemaining -= item[offer] + 2;
    } else
      itemsRemaining = 0;
  }
  cout << cost << endl;
  return 0;
}
