#include <bits/stdc++.h>
using namespace std;
int n, a, b;
int occ1, occ2, occ3;
int deny;
int main() {
  cin >> n >> a >> b;
  for (int i = 0; i != n; i++) {
    int cust;
    cin >> cust;
    if (cust == 2) {
      if (b - occ3 - occ2) {
        occ3++;
      } else {
        deny += 2;
      }
    } else {
      if (a - occ1) {
        occ1++;
      } else if (b - occ2 - occ3) {
        occ2++;
      } else if (occ2) {
        occ2--;
        occ3++;
      } else {
        deny++;
      }
    }
  }
  cout << deny << endl;
}
