import java.util.*;
import java.io.*;

public class Solution {

    public static void main(String[] args) {
        /* Enter your code here. Print output to STDOUT. Your class should be named Solution. */
        Scanner sc = new Scanner(System.in);
        int test= sc.nextInt();
        while(test-->0){
            int a = sc.nextInt();
            int b= sc.nextInt();
            int c= sc.nextInt();
            System.out.println(find(a,b,c,0));
        }
        
    }

    public static int find(int a , int b, int c, int count){
        if(b==0){
            return  count;
        }
        if(c>=a){
            int tmp= Math.min(b,c);
            return find(a,b-tmp,c-tmp-1,count+(2*tmp)+1);
        }
        if(a>c){
            int tmp= Math.min(a,b);
            return find(a-tmp+1,b-tmp,c,count+(2*tmp));
        }   
        return count;
    }
}
 
