#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, a, b, count = 0, t, half, full;
  scanf("%d%d%d", &n, &a, &b);
  half = 0, full = b;
  for (int i = 0; i < n; i++) {
    scanf("%d", &t);
    if (t == 1) {
      if (a > 0)
        a--;
      else {
        if (full)
          full--, half++;
        else if (half)
          half--;
        else
          count++;
      }
    } else if (t == 2) {
      if (full)
        full--;
      else
        count += 2;
    }
  }
  cout << count << '\n';
  return 0;
}
