#include <bits/stdc++.h>
using namespace std;
void help() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
}
int main() {
  help();
  long long n, k, c1 = 0, c2 = 0, a = 0, b = 0, b1 = 0, i = 0, x, sum = 0, t;
  cin >> n >> a >> b;
  for (int i = 0; i < n; i++) {
    cin >> x;
    if (x == 1) {
      if (a >= 1)
        a--;
      else if (b >= 1)
        b--, b1++;
      else if (b1 >= 1)
        b1--;
      else
        sum++;
    } else if (x == 2) {
      if (b >= 1)
        b--;
      else
        sum += 2;
    }
  }
  cout << sum << endl;
  return 0;
}
