#include <bits/stdc++.h>
using namespace std;
int N, A, B, X, Ans = 0, C = 0;
int main() {
  cin >> N >> A >> B;
  for (int i = 1; i <= N; i++) {
    cin >> X;
    if (X == 1) {
      if (A > 0)
        A--;
      else if (B > 0)
        C++, B--;
      else if (C > 0)
        C--;
      else
        Ans++;
    } else {
      if (B > 0)
        B--;
      else
        Ans += 2;
    }
  }
  cout << Ans;
  return 0;
}
