#include <bits/stdc++.h>
using namespace std;
const long long inf = 1e18;
const int nax = 1e5 + 200;
const double pi = acos(-1);
const double eps = 1e-10;
const int dr[] = {1, -1, 0, 0, 1, -1, -1, 1};
const int dc[] = {0, 0, 1, -1, 1, 1, -1, -1};
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  cout << setprecision(20) << fixed;
  long long n, a, b, b1;
  cin >> n >> a >> b;
  long long num;
  b1 = 0;
  long long ans = 0;
  for (int i = 0; i < (int)n; ++i) {
    cin >> num;
    if (num == 1) {
      if (a > 0) {
        a--;
      } else if (b > 0) {
        --b;
        b1++;
      } else if (b1 > 0) {
        b1--;
      } else {
        ans++;
      }
    }
    if (num == 2) {
      if (b > 0) {
        --b;
      } else {
        ans += 2;
      }
    }
  }
  cout << ans << '\n';
}
