#include <bits/stdc++.h>
int main() {
  int n, a, b, i, temp, c = 0, count = 0;
  scanf("%d %d %d", &n, &a, &b);
  for (i = 0; i < n; i++) {
    scanf("%d", &temp);
    if (temp == 1) {
      if (a != 0)
        a--;
      else if (b != 0) {
        b--;
        c++;
      } else if (c != 0)
        c--;
      else
        count++;
    } else if (temp == 2) {
      if (b != 0)
        b--;
      else
        count = count + 2;
    }
  }
  printf("%d", count);
  return 0;
}
