G, C, P = map(int, input().split()) S = input() eg = S.count("G") ec = S.count("C") ep = S.count("P") x, y, z = min(G, ec), min(C, ep), min(P, eg) point = (x + y + z) * 3 G -= x ec -= x C -= y ep -= y P -= z eg -= z point += min(G, eg) + min(C, ec) + min(P, ep) print(point)