#include <bits/stdc++.h>
using namespace std;
const int INF = 1e9 + 10;
int n, a, b;
int main() {
  cin >> n >> a >> b;
  int table1_count = 0;
  int table2_count = 0;
  int one_two_count = 0;
  int ans = 0;
  for (int i = 0; i < n; i++) {
    int t;
    cin >> t;
    if (t == 1) {
      bool is_sit = false;
      if (table1_count < a) {
        table1_count++;
        is_sit = true;
      }
      if (!is_sit) {
        if (table2_count < b) {
          table2_count++;
          one_two_count++;
          is_sit = true;
        }
      }
      if (!is_sit) {
        if (one_two_count > 0) {
          one_two_count--;
          is_sit = true;
        }
      }
      if (!is_sit) {
        ans++;
      }
    } else {
      if (table2_count < b) {
        table2_count++;
      } else {
        ans += 2;
      }
    }
  }
  cout << ans << endl;
  return 0;
}
