#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5 + 10;
int a = 0;
int b = 0;
int c = 0;
int d[maxn] = {0};
int main() {
  cin.sync_with_stdio(false);
  int n;
  cin >> n;
  cin >> a >> b;
  for (int i = 1; i <= n; ++i) {
    cin >> d[i];
  }
  long long ans = 0;
  for (int i = 1; i <= n; ++i) {
    if (d[i] == 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;
  return 0;
}
