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