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]); char[] h = br.readLine().toCharArray(); int ans = 0; for (int i = 0; i < h.length; i++) { if (h[i] == 'G') { if (p > 0) { p--; ans += 3; } else if (g > 0) { g--; ans++; } else { c--; } } else if (h[i] == 'C') { if (g > 0) { g--; ans += 3; } else if (c > 0) { c--; ans++; } else { p--; } } else { if (c > 0) { c--; ans += 3; } else if (p > 0) { p--; ans++; } else { g--; } } } out(ans); } }