#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, a, b, c = 0, r[2000000];
  int s = 0;
  scanf("%d%d%d", &n, &a, &b);
  for (int i = 0; i < n; i++) scanf("%d", &r[i]);
  for (int i = 0; i < n; i++) {
    if (r[i] == 1) {
      if (a > 0)
        a--;
      else if (b > 0) {
        b--;
        c++;
      } else if (c > 0)
        c--;
      else
        s++;
    } else if (r[i] == 2) {
      if (b > 0)
        b--;
      else
        s += 2;
    }
  }
  printf("%d", s);
  return 0;
}
