G,C,P=map(int,raw_input().split()) S=raw_input() g,c,p=0,0,0 for s in S: if s=='C': c+=1 if s=='G': g+=1 if s=='P': p+=1 ans=0 gwin=min(G,c) cwin=min(C,p) pwin=min(P,g) ans += 3*(gwin+cwin+pwin) G-=gwin c-=gwin C-=cwin p-=cwin P-=pwin g-=pwin ans += min(G,g)+min(C,c)+min(P,p) print ans