package yukicoder; import java.util.Scanner; public class N161 { static int score=0; static int[] gcp=new int[3]; static int[] ygcp=new int[3]; public static void main(String[] args) { Scanner sc = new Scanner(System.in); for(int i=0;i<3;i++) { gcp[i]=sc.nextInt(); } String you=sc.next(); for(int i=0;i=gcp[i]) { ygcp[(i+1)%3]-=gcp[i];score+=3*gcp[i];gcp[i]=0; } else { gcp[i]-=ygcp[(i+1)%3];score+=3*ygcp[(i+1)%3];ygcp[(i+1)%3]=0; } } for(int i=0;i<3;i++) { score=(ygcp[i]>=gcp[i])?score+gcp[i]:score+ygcp[i]; } System.out.println(score); } }