import java.util.*; public class Main { public static void main (String[] args) { Scanner sc = new Scanner(System.in); int t = sc.nextInt(); StringBuilder sb = new StringBuilder(); for (int i = 0; i < t; i++) { int d = sc.nextInt(); int a = sc.nextInt(); int b = sc.nextInt(); long left = (long)(Math.max(a - 1, 0)) / (d - 1) * d * (d - 1) / 2; int leftMod = (Math.max(a - 1, 0)) % (d - 1); left += (long)leftMod * (leftMod + 1) / 2; long right = (long)b / (d - 1) * d * (d - 1) / 2; int rightMod = b % (d - 1); right += (long)rightMod * (rightMod + 1) / 2; sb.append(right - left).append("\n"); } System.out.print(sb); } }