def janken(G, C, P, S): p = 0 S = list(S) for i in range(len(S)): if (S[i] == 'G') and (P > 0): P -= 1 p += 3 S[i] = 0 elif (S[i] == 'C') and (G > 0): G -= 1 p += 3 S[i] = 0 elif (S[i] == 'P') and (C > 0): C -= 1 p += 3 S[i] = 0 for s in S: if s == 0: continue elif (s == 'G') and (G > 0): G -= 1 p += 1 elif (s == 'C') and (C > 0): C -= 1 p += 1 elif (s == 'P') and (P > 0): P -= 1 p += 1 return p def main(): G, C, P = map(int, input().split()) S = input() print(janken(G, C, P, S)) if __name__ == '__main__': main()