#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:5000000000")
const unsigned long long mod = 1000000007;
long long Inf = (long long)2e9;
long long LINF = (long long)1e18 + 1e17;
using namespace std;
int main() {
  int n, a1, a0 = 0, b;
  cin >> n >> a1 >> b;
  int ans = 0;
  while (n--) {
    int t;
    scanf("%d", &(t));
    if (t == 2) {
      if (b)
        b--;
      else
        ans += 2;
    } else {
      if (a1)
        a1--;
      else if (b) {
        b--;
        a0++;
      } else if (a0)
        a0--;
      else
        ans++;
    }
  }
  cout << ans;
  return 0;
}
