#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, a, b;
  cin >> n >> a >> b;
  int B = 2 * b;
  int arr[n], temp;
  for (int i = 0; i < n; ++i) cin >> arr[i];
  int i = 0, ans = 0;
  while (i < n && (a || b || B)) {
    if (arr[i] == 2) {
      if (b > 0 && B > 1) {
        --b;
        B = B - 2;
      } else
        ans += 2;
    } else {
      if (a > 0)
        --a;
      else if (B > 0) {
        --B;
        if (b > 0) --b;
      } else
        ans += 1;
    }
    ++i;
  }
  if (i != n) {
    while (i != n) ans += arr[i++];
  }
  cout << ans << endl;
  return 0;
}
