G,C,P = map(int, raw_input().split()) S = raw_input() res = 0 aiko = [] for hand in S: if (hand == 'G'): if (P > 0): res += 3 P -= 1 else: aiko.append(hand) elif (hand == 'C'): if (G > 0): res += 3 G -= 1 else: aiko.append(hand) else: if (C > 0): res += 3 C -= 1 else: aiko.append(hand) for hand in aiko: if (hand == 'G'): if (G > 0): res += 1 G -= 1 elif (hand == 'C'): if (C > 0): res += 1 C -= 1 else: if (P > 0): res += 1 P -= 1 print res