package no161; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int gx = sc.nextInt(); int cx = sc.nextInt(); int px = sc.nextInt(); int gy = 0, cy = 0, py = 0; char[] s = sc.next().toCharArray(); int n = s.length; for(int i=0;i gx || gg > gy) { break; } for(int gc=0;gc<=300;gc++) { if (gg+gc > gx || gc > cy) { break; } for(int cg=0;cg<=300;cg++) { if (gg+cg > gy || cg > cx) { break; } int gp = gx - gg - gc; int pg = gy - gg - cg; if (gp > py || pg > px) { continue; } int cp = Math.min(cx - cg, py - gp); int cc = cx - cg - cp; int pp = py - gp - cp; // System.out.println("---"); // System.out.println(gg + " " + gc + " " + gp + "\n" + cg + " " + cc + " " + cp + "\n" + pg + " " + (px - pg - pp) + " " + pp); max = Math.max(max, (gc + cp + pg) * 3 + gg + cc + pp); } } } System.out.println(max); } }