# -*- coding: utf-8 -*- G, C, P = map(int, input().split()) S = input() g=c=p=0 for s in S: if s=='G': g += 1 elif s=='C': c += 1 else: p += 1 score = 0 # G,C,Pをまず勝てる方向で費やす score += 3*(min(G,c)+min(C,p)+min(P,g)) G = max(0, G-c) C = max(0, C-p) P = max(0, P-g) g = max(0, g-P) c = max(0, c-G) p = max(0, p-C) # 残りは出来る限りあいこの方向で費やす score += min(G,g)+min(C,c)+min(P,p) print(score)