#include <bits/stdc++.h>
using namespace std;
template <typename T>
inline bool chkmin(T &a, const T &b) {
  return a > b ? a = b, 1 : 0;
}
template <typename T>
inline bool chkmax(T &a, const T &b) {
  return a < b ? a = b, 1 : 0;
}
inline int read() {
  register int c(getchar()), sum(0), fg(1);
  while (c < '0' || c > '9') {
    if (c == '-') fg = -1;
    c = getchar();
  }
  while (c >= '0' && c <= '9') sum = sum * 10 + c - '0', c = getchar();
  return sum * fg;
}
const int oo = 0x3f3f3f3f;
int N, ans, a, b, c;
int main() {
  N = read(), a = read(), b = read();
  for (int i = (1), i_end_ = (N); i <= i_end_; ++i) {
    int x = read();
    if (x == 1) {
      if (a)
        --a;
      else if (b)
        --b, ++c;
      else if (c)
        --c;
      else
        ++ans;
    } else {
      if (b)
        --b;
      else
        ans += 2;
    }
  }
  printf("%d\n", ans);
  return 0;
}
