#include <bits/stdc++.h>
using namespace std;
void bubble(int* a, int n) {
  int min = a[0];
  for (int i = 1; i < n; i++) {
    if (a[i] < min) {
      min = a[i];
    }
  }
  a[n - 1] = min;
}
int compare(const void* a, const void* b) { return (*(int*)a - *(int*)b); }
void bubble_inv(int* a, int n) {
  for (int i = n - 1; i > 0; i--) {
    for (int j = 0; j < i; j++) {
      if (a[j] > a[j + 1]) {
        int tmp = a[j];
        a[j] = a[j + 1];
        a[j + 1] = tmp;
      }
    }
  }
}
int main() {
  int sk;
  int* st_sk;
  int need;
  int* st_need;
  cin >> sk;
  st_sk = new int[sk];
  for (int i = 0; i < sk; i++) {
    cin >> st_sk[i];
  }
  cin >> need;
  st_need = new int[need];
  for (int i = 0; i < need; i++) {
    cin >> st_need[i];
  }
  int answer = 0;
  bubble(st_sk, sk);
  qsort(st_need, need, sizeof(int), compare);
  if (need < 0) {
    need = 0;
  }
  if (st_sk[sk - 1] < 0) {
    st_sk[sk - 1] = 0;
  }
  while (need > 0) {
    if (sk > 0) {
      if (st_sk[sk - 1] <= need) {
        for (int i = 0; i < st_sk[sk - 1]; i++) {
          answer += st_need[need - 1];
          need--;
        }
        if (need > 1) {
          need -= 2;
        } else if (need > 0) {
          need -= 1;
        }
      } else {
        answer += st_need[need - 1];
        need--;
      }
    } else {
      answer += st_need[need - 1];
      need--;
    }
  }
  cout << answer;
  return 0;
}
