G,C,P = map(int,input().split()) S = input().strip() A = {"G":0,"C":0,"P":0} for a in S: A[a] += 1 ans = 0 ans += 3*(min(G,A["C"])+min(C,A["P"])+min(P,A["G"])) G,A["C"] = max(0,G-A["C"]),max(0,A["C"]-G) C,A["P"] = max(0,C-A["P"]),max(0,A["P"]-C) P,A["G"] = max(0,P-A["G"]),max(0,A["G"]-P) ans += min(G,A["G"])+min(C,A["C"])+min(P,A["P"]) print(ans)