#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, i, j, k, a, b;
  cin >> n >> a >> b;
  int denied = 0;
  int flag = 0;
  for (i = 0; i < n; i++) {
    cin >> k;
    if (k == 2) {
      if (b > 0)
        b--;
      else
        denied += 2;
    } else {
      if (a > 0)
        a--;
      else {
        if (b > 0) {
          b--;
          flag++;
        } else if (flag > 0)
          flag--;
        else {
          denied++;
        }
      }
    }
  }
  cout << denied << endl;
  return 0;
}
