G,C,P = map(int,input().split()) s=input() g,c,p = map(s.count,"GCP") X,Y,Z = map(min,[G,C,P],[c,p,g]) G,C,P = G-X,C-Y,P-Z g,c,p = g-Z,c-X,p-Y x,y,z = map(min,[G,C,P],[g,c,p]) n=(X+Y+Z)*3+(x+y+z) print(n)