def read_data(): G, C, P = map(int, input().split()) S = input() return G, C, P, S def solve(G, C, P, S): ng = S.count('G') nc = S.count('C') np = S.count('P') score = 0 # ng <- P if ng >= P: score += 3 * P ng -= P P = 0 else: score += 3 * ng P -= ng ng = 0 # nc <- G if nc >= G: score += 3 * G nc -= G G = 0 else: score += 3 * nc G -= nc nc = 0 # np <- C if np >= C: score += 3 * C np -= C C = 0 else: score += 3 * np C -= np np = 0 # ng <- G if ng >= G: score += G ng -= G G = 0 else: score += ng G -= ng ng = 0 # nc <- C if nc >= C: score += C nc -= C C = 0 else: score += nc C -= nc nc = 0 # np <- P if np >= P: score += P np -= P P = 0 else: score += np P -= np np = 0 return score if __name__ == '__main__': param = read_data() print(solve(*param))