import java.util.Scanner; public class Main { public static void main(String[] args) throws Exception { Scanner sc = new Scanner(System.in); int t = sc.nextInt(); for (int z = 0; z < t; z++) { long d = sc.nextInt(); long x = sc.nextInt(); long y = sc.nextInt(); long ok = 0; long ng = d * 2 + 1; while (Math.abs(ok - ng) > 1) { long mid = (ok + ng) / 2; long nx = x + y * mid; long ny = y - x * mid; if (nx <= d && 0 <= ny) { ok = mid; } else { ng = mid; } } long bx = x + y * ok; long by = y - x * ok; long ans1 = Math.abs(x * by - bx * y); ok = 0; ng = d * 2 + 1; while (Math.abs(ok - ng) > 1) { long mid = (ok + ng) / 2; long nx = x - y * mid; long ny = y + x * mid; if (0 <= nx && ny <= d) { ok = mid; } else { ng = mid; } } bx = x - y * ok; by = y + x * ok; long ans2 = Math.abs(x * by - bx * y); System.out.println(Math.max(ans1, ans2)); } sc.close(); } }