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; for(int i=0; i0) { P--; ans+=3; } else if(G>0) { G--; ans+=1; } else if(C>0) { C--; } } else if(look == 'C') { if (G>0) { G--; ans+=3; } else if(C>0) { C--; ans+=1; } else if(P>0) { P--; } } else if(look == 'P') { if (C>0) { C--; ans+=3; } else if(P>0) { P--; ans+=1; } else if(G>0) { G--; } } } System.out.println(ans); } }