#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5 + 5;
int n, a, b, c, cnt;
int aa;
int main() {
  cin >> n >> a >> b;
  for (int i = 1; i <= n; i++) {
    cin >> aa;
    if (aa == 1) {
      if (a != 0)
        a--;
      else if (b != 0)
        b--, c++;
      else if (c != 0)
        c--;
      else
        cnt++;
    } else if (b != 0)
      b--;
    else
      cnt += 2;
  }
  cout << cnt;
  return 0;
}
