#include <bits/stdc++.h>
using namespace std;
int const INF = numeric_limits<int>::max();
int main() {
  ios::sync_with_stdio(false);
  int n, a, b;
  int two_with_one = 0;
  cin >> n >> a >> b;
  int refused = 0;
  for (int i = 0; i < n; i++) {
    int x;
    cin >> x;
    if (x == 1) {
      if (a > 0) {
        a--;
      } else if (b > 0) {
        b--;
        two_with_one++;
      } else if (two_with_one > 0) {
        two_with_one--;
      } else {
        refused++;
      }
    } else {
      if (b > 0) {
        b--;
      } else {
        refused += 2;
      }
    }
  }
  cout << refused << endl;
  return 0;
}
