import java.io.*; import java.util.*; import java.math.*; class Main { public static void out (Object o) { System.out.println(o); } public static void main (String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String[] line = br.readLine().split(" "); int g = Integer.parseInt(line[0]); int c = Integer.parseInt(line[1]); int p = Integer.parseInt(line[2]); String s = br.readLine(); int[] h = new int[3]; for (int i = 0; i < s.length(); i++) { char t = s.charAt(i); if (t == 'G') h[0]++; else if (t == 'C') h[1]++; else h[2]++; } int winPoint = (Math.min(g , h[1]) + Math.min(c , h[2]) + Math.min(p , h[0])) * 3; //out("w : " + winPoint); //out("g = " + g + " , c = " + c + " , p = " + p + "\th = " + Arrays.toString(h)); int sub = Math.min(g , h[1]); g -= sub; h[1] -= sub; sub = Math.min(c , h[2]); c -= sub; h[2] -= sub; sub = Math.min(p , h[0]); p -= sub; h[0] -= sub; int drawPoint = Math.min(g , h[0]) + Math.min(c , h[1]) + Math.min(p , h[2]); //out("g = " + g + " , c = " + c + " , p = " + p + "\th = " + Arrays.toString(h)); out(winPoint + drawPoint); } }