#include <bits/stdc++.h>
const int inf = 0x3f3f3f3f;
const int maxn = 500050;
const int mod = 1e9 + 7;
using namespace std;
int main() {
  ios::sync_with_stdio(0);
  int n, a, b;
  cin >> n >> a >> b;
  int c = 0, ans = 0;
  for (int i = 1; i <= n; i++) {
    int x;
    cin >> x;
    if (x == 1) {
      if (a > 0)
        a--;
      else {
        if (b > 0) {
          b--;
          c++;
        } else if (c > 0)
          c--;
        else
          ans++;
      }
    } else {
      if (b > 0)
        b--;
      else
        ans += 2;
    }
  }
  cout << ans << endl;
}
