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