#include <bits/stdc++.h>
using namespace std;
long n, a, b, ans = 0, a1 = 0;
int t[200001], x;
int main() {
  cin >> n >> a >> b;
  for (long i = 0; i <= n - 1; i++) {
    cin >> x;
    if (x == 1) {
      if (a)
        a--;
      else if (b) {
        b--;
        a1++;
      } else if (a1)
        a1--;
      else
        ans++;
    } else {
      if (b)
        b--;
      else
        ans += 2;
    }
  }
  cout << ans;
}
