local mfl, mce = math.floor, math.ceil
local q = io.read("*n")
local function solve(d, x)
  local rem = x % (d - 1)
  local div = mfl(x / (d - 1))
  local sum = (d - 1LL) * d / 2LL
  local ret = sum * div
  sum = (rem + 1LL) * rem / 2LL
  ret = ret + sum
  return ret
end
for iq = 1, q do
  local d, a, b = io.read("*n", "*n", "*n")
  local ret = solve(d, b)
  if 1 < a then
    ret = ret - solve(d, a - 1)
  end
  ret = tostring(ret):gsub("LL", "")
  print(ret)
end