#include <bits/stdc++.h>
using namespace std;
int denies(int *test, int num, int one, int two);
void cinarr(int *test, int num);
int main() {
  int n, a, b, x;
  int *t = new int[200005];
  cin >> n >> a >> b;
  cinarr(t, n);
  cout << denies(t, n, a, b);
  delete[] t;
}
int denies(int *test, int num, int one, int two) {
  int one2 = 0, result = 0;
  for (int i = 0; i < num; i = i + 1) {
    if (*(test + i) == 1) {
      if (one > 0)
        one--;
      else if (two > 0) {
        two--;
        one2++;
      } else if (one2 > 0)
        one2--;
      else
        result++;
    } else {
      if (two > 0)
        two--;
      else
        result += 2;
    }
  }
  return result;
}
void cinarr(int *test, int num) {
  for (int i = 0; i < num; i++) cin >> *(test + i);
}
