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(); String S = sc.next(); int ans = 0; String nextS = ""; //勝てる手 for(int i=0; i0) { P--; ans+=3; find=true; } } else if(look == 'C') { if(G>0) { G--; ans+=3; find=true; } } else if(look == 'P') { if(C>0) { C--; ans+=3; find=true; } } if(find==false) { nextS += look; } } S = nextS; //あいこの手 for(int i=0; i0) { G--; ans+=1; } } else if(look == 'C') { if(C>0) { C--; ans+=1; } } else if(look == 'P') { if(P>0) { P--; ans+=1; } } } System.out.println(ans); } }