#include <bits/stdc++.h>
using namespace std;
const long long N = 1e6 + 10;
long long n, m[N], a[N], b[N], k = 0, l = 0, i, j = 0, mn = 0, mx = 0, ans = 0,
                               r1 = 0, r2 = 0, r3 = 0, t, q, v = 0;
string d1, d3, d2, s;
pair<long long, long long> g[N];
char lk, kl = 'a';
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  ;
  cin >> n >> k >> l;
  for (i = 1; i <= n; i++) {
    cin >> ans;
    if (ans == 1) {
      if (k > 0)
        k--;
      else if (l > 0) {
        l--;
        r1++;
      } else if (r1 > 0)
        r1--;
      else
        r2++;
    } else if (ans == 2) {
      if (l > 0)
        l--;
      else
        r2 += 2;
    }
  }
  cout << r2;
  return 0;
}
