#include <bits/stdc++.h>
using std::cin;
using std::cout;
using std::deque;
using std::endl;
using std::map;
using std::max;
using std::min;
using std::multiset;
using std::pair;
using std::queue;
using std::set;
using std::sort;
using std::stack;
using std::string;
using std::vector;
int main() {
  int n, a, b, c = 0;
  cin >> n >> a >> b;
  int answer = 0;
  for (int i = 0; i < n; i++) {
    int x;
    cin >> x;
    if (x == 1) {
      if (a > 0) {
        a--;
      } else if (b > 0) {
        b--;
        c++;
      } else if (c > 0) {
        c--;
      } else {
        answer++;
      }
    } else {
      if (b > 0) {
        b--;
      } else {
        answer += 2;
      }
    }
  }
  cout << answer;
  return 0;
}
