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