#include <bits/stdc++.h>
using namespace std;
const long long oo = 1e9;
const int maxSize = 1001000;
const int mod = 1e9 + 7;
const double EPS = (1e-9);
int dcmp(double x, double y) { return fabs(x - y) <= EPS ? 0 : x < y ? -1 : 1; }
int main() {
  int one = 0, remain1 = 0, two = 0, a, b;
  int n, res = 0;
  scanf("%d%d%d", &n, &a, &b);
  for (int i = 0; i < n; i++) {
    int num;
    scanf("%d", &num);
    if (num == 1) {
      if (a)
        a--;
      else if (remain1 < 2 * b)
        remain1++;
      else
        res++;
    } else {
      if (b - remain1 > 0)
        b--;
      else
        res += 2;
    }
  }
  cout << res;
}
