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)(a - 1) / (d - 1) * d * (d - 1) / 2; int leftMod = (a - 1) % (d - 1); left += leftMod * (leftMod + 1) / 2; long right = (long)b / (d - 1) * d * (d - 1) / 2; int rightMod = b % (d - 1); right += rightMod * (rightMod + 1) / 2; sb.append(right - left).append("\n"); } System.out.print(sb); } }