import java.util.Arrays; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int G = sc.nextInt(); int C = sc.nextInt(); int P = sc.nextInt(); char[] string = sc.next().toCharArray(); Arrays.sort(string); sc.close(); int oG = 0; int oC = 0; int oP = 0; for (char d : string) { if (d == 'G') { oG++; } else if (d == 'C') { oC++; } else { oP++; } } int point = 0; point += Math.min(G, oC) * 3; point += Math.min(C, oP) * 3; point += Math.min(P, oG) * 3; if (G >= oC) { G -= oC; oC = 0; } else { oC -= G; G = 0; } if (C >= oP) { C -= oP; oP = 0; } else { oP -= C; C = 0; } if (P >= oG) { P -= oG; oG = 0; } else { oG -= P; P = 0; } point += Math.min(G, oG); point += Math.min(C, oC); point += Math.min(P, oP); System.out.println(point); } }