#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pl = pair<ll, ll>;
using vl = vector<ll>;
using vvl = vector<vl>;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n, a, b;
  cin >> n >> a >> b;
  int res = 0;
  unordered_map<string, int> ump;
  ump["vacant_1"] = a;
  ump["vacant_2"] = b;
  ump["single_2"] = 0;
  while (n--) {
    int t;
    cin >> t;
    if (t == 2) {
      if (ump["vacant_2"]) {
        ump["vacant_2"]--;
      } else
        res += 2;
    } else {
      if (ump["vacant_1"]) {
        ump["vacant_1"]--;
      } else if (ump["vacant_2"]) {
        ump["vacant_2"]--;
        ump["single_2"]++;
      } else if (ump["single_2"]) {
        ump["single_2"]--;
      } else
        res++;
    }
  }
  cout << res;
  return 0;
}
