#include <bits/stdc++.h>
using namespace std;
template <typename T>
T gcd(T a, T b) {
  if (a == 0) return b;
  return gcd(b % a, a);
}
template <typename T>
T pow(T a, T b, long long m) {
  T ans = 1;
  while (b > 0) {
    if (b % 2 == 1) ans = (ans * a) % m;
    b /= 2;
    a = (a * a) % m;
  }
  return ans % m;
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n, a, b;
  cin >> n >> a >> b;
  int t;
  int deny = 0;
  int half = 0;
  for (int i = 0; i < n; i++) {
    cin >> t;
    if (t == 2) {
      if (b == 0)
        deny += 2;
      else
        b--;
    }
    if (t == 1) {
      if (a != 0)
        a--;
      else if (b > 0) {
        b--;
        half++;
      } else if (half > 0) {
        half--;
      } else
        deny++;
    }
  }
  cout << deny << "\n";
  return 0;
}
