#include <bits/stdc++.h>
using namespace std;
int n, va, vb, oneb, temp, deny;
int main() {
  oneb = 0, deny = 0;
  cin >> n >> va >> vb;
  for (int i = 0; i < n; i++) {
    cin >> temp;
    if (temp == 1) {
      if (va > 0)
        va--;
      else {
        if (vb > 0) {
          vb--;
          oneb++;
        } else {
          if (oneb > 0) {
            oneb--;
          } else {
            deny++;
          }
        }
      }
    } else {
      if (vb > 0)
        vb--;
      else
        deny += 2;
    }
  }
  cout << deny;
  return 0;
}
