#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  ;
  long long precision = numeric_limits<double>::digits10;
  ;
  long long n, a, b, c = 0;
  cin >> n >> a >> b;
  long long ans = 0;
  for (long long i = 1; i <= n; i++) {
    long long temp;
    cin >> temp;
    if (temp == 1) {
      if (a > 0) {
        a -= 1;
      } else if (b > 0) {
        b -= 1;
        c += 1;
      } else if (c > 0)
        c -= 1;
      else
        ans += 1;
    } else if (temp == 2) {
      if (b > 0) {
        b -= 1;
      } else
        ans += 2;
    }
  }
  cout << ans << endl;
}
