import java.util.*;
public class GFG {
	public static void main (String[] args) {
		Scanner sc=new Scanner(System.in);
		int t=sc.nextInt();
		while (t-->0){ 
		int a=sc.nextInt();
		int b=sc.nextInt();
		int c=sc.nextInt();
	    int max=0;
	    int sum=0,b1=0;
	    for(int i=1;i<=a;i++)
	    {
	        b1=b;
	        if(i*2<=b){
	        sum=sum+i+i*2;
	        b=b-i*2;}
	        int sum1=sum;
	        for(int j=1;j<=b;j++)
	        {
	            if(2*j<=c)
	            sum=sum+j+2*j;
	            if(sum>max)
	            max=sum;
	            sum=sum1;
	        }
	        if(sum1>max)
	        max=sum1;
	        sum=0;b=b1;
	    }
	    if(a==0){
	    for(int i=1;i<=b;i++)
	    {
	        if(2*i<=c)
	        sum=sum+i+2*i;
	        if(sum>max)
	        max=sum;
	        sum=0;
	    }}
	    System.out.println(max);
		}
	}
}
		