using System; using System.Collections.Generic; using System.Linq; class Program { static void Main(string[] args) { var T = int.Parse(Console.ReadLine()); for (int i = 0; i < T; i++) { var input = Console.ReadLine().Split().Select(ulong.Parse).ToArray(); var A = input[0]; var B = input[1]; var C = input[2]; var ans = 0UL; var min = Math.Min(A, C); ans += 2 * min; A -= min; C -= min; var quo = B / 2; ans += 2 * quo; B -= 2 * quo; if (B == 1) if (A >= 1) ans++; if (C > 1) ans += C / 2; Console.WriteLine(ans); } } }