#include <bits/stdc++.h>
using namespace std;
int main() {
  int m, n, i, ans = 0, j, k, rem;
  cin >> m;
  int arr[m];
  for (i = 0; i < m; i++) {
    cin >> arr[i];
  }
  sort(arr, arr + m);
  cin >> n;
  int price[n];
  for (i = 0; i < n; i++) {
    cin >> price[i];
  }
  sort(price, price + n, greater<int>());
  i = 0;
  j = 0;
  rem = n;
  while (1) {
    if (rem > arr[i]) {
      for (k = 0; k < arr[i]; k++) ans += price[k + j];
      j += k + 2;
      rem -= (arr[i] + 2);
      if (rem <= 0) break;
    } else {
      for (; j < n; j++) ans += price[j];
      break;
    }
  }
  cout << ans << endl;
  return 0;
}
