#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 10;
const long long INF = 1e5 + 10;
const int MOD = 1e9 + 7;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int m;
  cin >> m;
  vector<int> sup(m, 0);
  for (int i = 0; i < m; i++) cin >> sup[i];
  int n;
  cin >> n;
  vector<int> th(n, 0);
  for (int i = 0; i < n; i++) cin >> th[i];
  int arr = 0;
  sort(sup.begin(), sup.end());
  sort(th.begin(), th.end());
  int u = n - 1, a = 0, cnt = 0;
  while (u >= 0) {
    arr += th[u];
    cnt++;
    u--;
    if (cnt == sup[a]) {
      u = max(u - 2, -1);
      cnt = 0;
    }
  }
  cout << arr;
}
