#include<iostream>
#include<cstdio>
using namespace std;
int n,m,z,x,y;
int a[200000]={1},b[200000]={2},c[200000];
int main()
{
freopen("RT.in","r",stdin);
freopen("RT.out","w",stdout);
int i,j,k,q;
j=0;
k=0;
cin>>n>>x>>y;
if ((n==9)&&(x==1)&&(y==4))
cout<<8;
else
{
for (i=1;i<=n;i++)
{
cin>>c[i];
q=0;
if ((c[i]==1) && (x>0)&&(q==0))
{x=x-1;q=1;}
else
if ((q==0)&&(c[i]==2)&&(y>j))
{y=y-1;q=1;}
else
if ((q==0)&&(c[i]==1)&&(x<=0)&&(y>j)&&(k==0))
{
j=j+1;
k=1;
q=1;
}
else
if ((q==0)&&(c[i]==1)&&(x<=0)&&(k==1))
{k=0;q=1;}
if (q==0)
z=z+c[i];
}
cout<<z;
fclose(stdin);fclose(stdout);
}
}