gi, ci, pi = map(int, input().split()) s = list(input()) s.sort() res = 0 for c in s: if c == "C": if gi > 0: gi -= 1 res += 3 elif ci > 0: ci -= 1 res += 1 if c == "G": if pi > 0: pi -= 1 res += 3 elif gi > 0: gi -= 1 res += 1 if c == "P": if ci > 0: ci -= 1 res += 3 elif pi > 0: pi -= 1 res += 1 print(res)