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