using System; using System.Collections; using System.Collections.Generic; using System.Collections.Specialized; using System.Text; using System.Text.RegularExpressions; using System.Linq; class Magatro { static void Main() { int G, C, P; string[] s = Console.ReadLine().Split(' '); G = int.Parse(s[0]); C = int.Parse(s[1]); P = int.Parse(s[2]); string S = Console.ReadLine(); Dictionary cnt = new Dictionary(); cnt.Add('G', 0); cnt.Add('C', 0); cnt.Add('P', 0); for(int i = 0; i < S.Length; i++) { cnt[S[i]]++; } int ans = 0; int c = 0; int GG= Math.Min(G, cnt['C']); c += GG; G -= GG; cnt['C'] -= GG; GG = Math.Min(P, cnt['G']); c += GG; cnt['G'] -= GG; P -= GG; GG = Math.Min(C, cnt['P']); c += GG; cnt['P'] -= GG; C -= GG; ans += 3 * c; ans += Math.Min(G, cnt['G']) + Math.Min(C, cnt['C']) + Math.Min(P, cnt['P']); Console.WriteLine(ans); } }