G, C, P = map(int, input().split()) S = list(input()) N = len(S) inf = 10 ** 18 pre = [[-inf] * 305 for i in range(305)] pre[0][0] = 0 for i in range(N): dp = [[-inf] * 305 for i in range(305)] for g in range(G + 1): for c in range(C + 1): p = i - g - c if p < 0 or P < p: continue if S[i] == "G": dp[g + 1][c] = max(dp[g + 1][c], pre[g][c] + 1) dp[g][c + 1] = max(dp[g][c + 1], pre[g][c]) dp[g][c] = max(dp[g][c], pre[g][c] + 3) elif S[i] == "C": dp[g + 1][c] = max(dp[g + 1][c], pre[g][c] + 3) dp[g][c + 1] = max(dp[g][c + 1], pre[g][c] + 1) dp[g][c] = max(dp[g][c], pre[g][c]) else: dp[g + 1][c] = max(dp[g + 1][c], pre[g][c]) dp[g][c + 1] = max(dp[g][c + 1], pre[g][c] + 3) dp[g][c] = max(dp[g][c], pre[g][c] + 1) dp, pre= pre, dp print(pre[G][C])