#include <bits/stdc++.h>
using namespace std;
bool FindSeat(int group, int &one, int &two, int &occupied) {
  if (group == 1) {
    if (one > 0) {
      --one;
      return true;
    }
    if (two > 0) {
      --two;
      ++occupied;
      return true;
    }
    if (occupied > 0) {
      --occupied;
      return true;
    }
  } else {
    if (two > 0) {
      --two;
      return true;
    }
  }
  return false;
}
int main() {
  int n, one, two, occupied;
  cin >> n >> one >> two;
  occupied = 0;
  int res = 0;
  for (int i = 0; i < n; ++i) {
    int group;
    cin >> group;
    if (!FindSeat(group, one, two, occupied)) {
      res += group;
    }
  }
  cout << res << "\n";
  return 0;
}
