g,c,p=map(int,input().split()) s=list(input()) g2,c2,p2=0,0,0 for x in s: if x=="G": g2+=1 elif x=="C": c2+=1 else: p2+=1 l=[g2,c2,p2] ans=0 ans+=3*min(g,c2) ans+=3*min(c,p2) ans+=3*min(p,g2) g-=min(g,c2) c-=min(c,p2) p-=min(p,g2) if g>0 and g2>0: ans+=min(g,g2) elif c>0 and c2>0: ans+=(c,c2) elif p>0 and p2>0: ans+=(p,p2) print(ans)