#include <bits/stdc++.h>
using namespace std;
template <class T>
string ToString(T x) {
  stringstream ss;
  ss << x;
  return ss.str();
}
int v[100005];
int a[100005];
int n, m;
vector<int> q;
int main() {
  cin >> m;
  for (int i = 1; i <= m; i++) {
    int t;
    cin >> t;
    v[t] = 1;
    q.push_back(t);
  }
  sort((q).begin(), (q).end());
  cin >> n;
  for (int i = 1; i <= n; i++) cin >> a[i];
  sort(a + 1, a + n + 1);
  for (int i = 1; i <= n; i++) a[i] += a[i - 1];
  int rst = (1 << 30);
  int now = 0;
  for (int i = n; i >= 1; i--) {
    int s = i - q[0];
    s = max(0, s);
    now += (a[i] - a[s]);
    s--;
    i = s;
  }
  cout << now;
}
