#include <bits/stdc++.h>
using namespace std;
bool q[100005] = {false};
int main() {
  long long int m, t, n, i, j;
  cin >> m;
  for (i = 0; i < m; i++) {
    cin >> t;
    q[t] = true;
  }
  cin >> n;
  long long int arr[n];
  for (i = 0; i < n; i++) {
    cin >> arr[i];
  }
  sort(arr, arr + n);
  long long int count = 0, sum = 0;
  for (i = n - 1; i >= 0; i--) {
    sum += arr[i];
    count++;
    if (q[count]) {
      i = i - 2;
      count = 0;
    }
  }
  cout << sum << endl;
}
