#include #include #include #include using namespace std; int main(){ int g,g2 = 0,c,c2 = 0,p,p2 = 0,n,ans = 0; char s[303]; scanf("%d %d %d\n%s",&g,&c,&p,s); n = g + c + p; for(int i = 0;i < n;i++){ if(s[i] == 'G') g2++; else if(s[i] == 'C') c2++; else p2++; } int tmp = min(g2,p); ans += tmp*3,g2 -= tmp,p -= tmp; tmp = min(c2,g),ans += tmp*3,c2 -= tmp,g -= tmp; tmp = min(p2,c),ans += tmp*3,p2 -= tmp,c -= tmp; ans += (min(g2,g) + min(c2,c) + min(p2,p)); printf("%d\n",ans); return 0; }