import java.beans.IntrospectionException; import java.util.*; 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(); String te = sc.next(); int ans =0 ; for(int i=0;i0){ p--; ans+=3; }else if(g>0){ g--; ans+=1; }else{ c--; } }else if(te.charAt(i)=='C'){ if(g>0){ g--; ans+=3; }else if(c>0){ c--; ans+=1; }else{ p--; } }else{ if(c>0){ c--; ans+=3; }else if(p>0){ p--; ans+=1; }else{ g--; } } } System.out.println(ans); } }