#include <bits/stdc++.h>
using namespace std;
int n, a, b0, b1;
int p[200000];
int deny;
int main() {
  scanf("%d %d %d", &n, &a, &b0);
  for (int i = 0; i < n; i++) scanf("%d", &p[i]);
  deny = 0;
  for (int i = 0; i < n; i++) {
    if (p[i] == 1) {
      if (a > 0)
        a--;
      else if (b0 > 0) {
        b0--;
        b1++;
      } else if (b1 > 0)
        b1--;
      else
        deny++;
    } else {
      if (b0 > 0)
        b0--;
      else
        deny += 2;
    }
  }
  printf("%d\n", deny);
}
