from collections import Counter g, c, p = map(int, input().split()) s = input() n = g + c + p DP = [[[-1 for _ in range(p + 1)] for _ in range(c + 1)] for _ in range(g + 1)] DP[g][c][p] = 0 for i in range(n): ss = s[i] res = n - i for j in range(g + 1): for k in range(c + 1): if 0 <= res - j - k <= p: l = res - j - k if ss == 'G': if j > 0: DP[j - 1][k][l] = max(DP[j - 1][k][l], DP[j][k][l] + 1) if k > 0: DP[j][k - 1][l] = max(DP[j][k - 1][l], DP[j][k][l]) if l > 0: DP[j][k][l - 1] = max(DP[j][k][l - 1], DP[j][k][l] + 3) elif ss == 'C': if j > 0: DP[j - 1][k][l] = max(DP[j - 1][k][l], DP[j][k][l] + 3) if k > 0: DP[j][k - 1][l] = max(DP[j][k - 1][l], DP[j][k][l] + 1) if l > 0: DP[j][k][l - 1] = max(DP[j][k][l - 1], DP[j][k][l]) else: if j > 0: DP[j - 1][k][l] = max(DP[j - 1][k][l], DP[j][k][l]) if k > 0: DP[j][k - 1][l] = max(DP[j][k - 1][l], DP[j][k][l] + 3) if l > 0: DP[j][k][l - 1] = max(DP[j][k][l - 1], DP[j][k][l] + 1) print(DP[0][0][0])