T = int(input()) for _ in range(T): d, A, B = map(int, input().split()) LM, RM = (A - 2) % (d - 1) + 1, (B - 1) % (d - 1) % (d - 1) + 1 L = ((A - 2) // (d - 1)) * (d * (d - 1) // 2) + LM * (LM + 1) // 2 R = ((B - 1) // (d - 1)) * (d * (d - 1) // 2) + RM * (RM + 1) // 2 print(R - L)