#include <bits/stdc++.h>
using namespace std;
int maxx(int fd, int sd) { return (fd > sd) ? fd : sd; }
int minn(int fd, int sd) { return (fd < sd) ? fd : sd; }
long long gcd(long long a, long long b) {
  if (a == 0) return b;
  if (b == 0) return a;
  if (a < b)
    return gcd(b % a, a);
  else
    return gcd(a % b, b);
}
int main() {
  int n10, n20, n21;
  int n, a, b, fix;
  fix = 0;
  scanf("%d %d %d", &n, &a, &b);
  n10 = a;
  n20 = b;
  n21 = 0;
  for (int i = 0; i < n; ++i) {
    int t;
    scanf("%d", &t);
    if (t == 1) {
      if (n10 > 0)
        n10--;
      else if (n20 > 0) {
        n20--;
        n21++;
      } else if (n21 > 0)
        n21--;
      else
        fix++;
    } else {
      if (n20 > 0)
        n20--;
      else
        fix += 2;
    }
  }
  printf("%d", fix);
  return 0;
}
