#include <bits/stdc++.h>
using namespace std;
const int MAXPOW = 20;
const int MAXA = 1048577;
const int MAXN = 100009;
const int MAXM = 100009;
int n, m;
vector<int> q;
vector<int> a;
int dp[MAXN];
int sum[MAXM];
int getSum(int l, int r) {
  l--;
  if (l < 0) return sum[r];
  return sum[r] - sum[l];
}
int solve(int pos) {
  if (pos >= n) {
    return 0;
  }
  if (dp[pos] == -1) {
    dp[pos] = a[pos] + solve(pos + 1);
    for (int i = 0; i < min(m, 100); ++i) {
      if (pos + q[i] > n) {
        break;
      }
      if (pos + q[i] + 1 <= n) {
        dp[pos] =
            min(dp[pos], solve(pos + q[i] + 1) + getSum(pos, pos + q[i] - 1));
      }
      if (pos + q[i] + 2 <= n) {
        dp[pos] =
            min(dp[pos], solve(pos + q[i] + 2) + getSum(pos, pos + q[i] - 1));
      }
    }
  }
  return dp[pos];
}
void gen() {
  freopen("input.txt", "w", stdout);
  int m = 100000;
  printf("%d\n", m);
  for (int i = 0; i < m; ++i) {
    printf("%d ", i + 1);
  }
  printf("\n");
  int n = 100000;
  printf("%d\n", n);
  for (int j = 0; j < n; ++j) {
    printf("%d ", j + 1);
  }
  exit(0);
}
int main() {
  memset(dp, -1, sizeof(dp));
  scanf("%d", &m);
  q.resize(m);
  for (int i = 0; i < m; ++i) {
    scanf("%d", &q[i]);
  }
  scanf("%d", &n);
  a.resize(n);
  for (int i = 0; i < n; ++i) {
    scanf("%d", &a[i]);
  }
  sort(q.begin(), q.end());
  q.resize(unique(q.begin(), q.end()) - q.begin());
  sort(a.begin(), a.end(), greater<int>());
  sum[0] = a[0];
  for (int i = 1; i < n; ++i) sum[i] = sum[i - 1] + a[i];
  cout << solve(0) << endl;
  return 0;
}
