#include <bits/stdc++.h>
using namespace std;
long long n, a, b, x, i, last, c;
vector<long long> v;
int main() {
  cin >> n >> a >> b;
  last = 0;
  c = 0;
  for (i = 0; i < n; i++) {
    cin >> x;
    if (x == 1) {
      if (a)
        a--;
      else {
        if (b) {
          b--;
          c++;
        } else if (c)
          c--;
        else
          last++;
      }
    } else {
      if (b)
        b--;
      else
        last += 2;
    }
  }
  cout << last << "\n";
  return 0;
}
