#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL);
  int m;
  cin >> m;
  int a[m];
  for (long long i = 0; i < m; i++) cin >> a[i];
  int n;
  cin >> n;
  int b[n];
  for (long long i = 0; i < n; i++) cin >> b[i];
  sort(a, a + m);
  sort(b, b + n);
  int i = n - 1;
  int j = 0;
  int c = 0, sum = 0;
  while (i >= 0 && j < m) {
    int t = a[j];
    while (c < n && t > 0 && i >= 0) {
      sum += b[i];
      c++;
      i--;
      t--;
    }
    i--;
    i--;
  }
  cout << sum << endl;
}
