#include <bits/stdc++.h>
using namespace std;
int main() {
  int singles, doubles, n;
  cin >> n >> singles >> doubles;
  int refused = 0, partlyOccDoubles = 0;
  for (int i = 0; i < n; i++) {
    int cur;
    cin >> cur;
    if (cur == 1) {
      if (singles > 0) {
        singles--;
      } else if (doubles > 0) {
        doubles--;
        partlyOccDoubles++;
      } else if (partlyOccDoubles > 0) {
        partlyOccDoubles--;
      } else {
        refused += cur;
      }
    } else {
      if (doubles == 0)
        refused += cur;
      else
        doubles--;
    }
  }
  cout << refused;
  return 0;
}
