#include <bits/stdc++.h>
using namespace std;
long long n, i, a, t, o, b, c, y, l;
int main() {
  cin >> n >> a >> b;
  for (i = 0; i < n; i++) {
    cin >> t;
    if (t == 2 and b == 0)
      y += 2;
    else if (t == 2 and b > 0)
      b--;
    if (t == 1 and a > 0)
      a--;
    else {
      if (t == 1 and a == 0 and b > 0)
        b--, c++;
      else {
        if (t == 1 and a == 0 and b == 0 and c > 0)
          c--;
        else {
          if (t == 1 and a == 0 and b == 0 and c == 0) y++;
        }
      }
    }
  }
  cout << y << endl;
  return 0;
}
