#include <bits/stdc++.h>
using namespace std;
int main() {
  setlocale(LC_ALL, "RUS");
  int n, x, j = 0, a, b, u = 0;
  cin >> n >> a >> b;
  b *= 2;
  while (n--) {
    cin >> x;
    if (x == 1) {
      if (a > 0)
        a--;
      else {
        if (b > 0) {
          b -= 2;
          u++;
        } else if (u > 0)
          u--;
        else
          j++;
      }
    } else {
      if (b >= 2)
        b -= 2;
      else
        j += 2;
    }
  }
  cout << j;
  return 0;
}
