#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, a, b, c = 0;
  int rez = 0;
  cin >> n >> a >> b;
  int k;
  for (int i = 0; i < n; i++) {
    cin >> k;
    if (k == 1) {
      if (a != 0)
        a--;
      else if (b != 0) {
        b--;
        c++;
      } else if (c != 0)
        c--;
      else
        rez++;
    } else {
      if (b != 0)
        b--;
      else
        rez += 2;
    }
  }
  cout << rez;
  return 0;
}
