You are given an arithmetic progression with 'n' terms: x, x + d, x + 2d, ..., x + (n-1)d. Find the product of all terms in this sequence modulo 1,000,003. You have 'Q' queries. For each query, compute the product given x, d, and n. Constraints: 1 ≤ Q ≤ 10^5, 0 ≤ xi, di ≤ 1,000,002, 1 ≤ ni ≤ 10^9. Input format: Q, x1 d1 n1, ..., xQ dQ nQ. Output format: Print Q lines, each containing the answer for the corresponding query. Sample Input: 2, 7 2 4, 12345 67890 2019. Sample Output: 9009, 916936.

# Buggy version:
Q = int(input())
mod = int(1e+6 + 3)

def doubling(n, m):
  y = 1
  p = n
  while m != 0:
    if m % 2 == 1:
      y *= p
      y %= mod
    m //= 2
    p *= n
    p %= mod
  return y

def inved(s):
  x, y, u, v, k, l = 1, 0, 0, 1, s, mod
  while l != 0:
    x, y, u, v = u, v, x - u * (k // l), y - v * (k // l)
    k, l = l, k % l
  return x % mod

frac = [1]
for i in range(mod):
  frac.append((frac[i]*(i+1))%mod)

for i in range(Q):
  x, d, n = map(int, input().split())
  if x == 0:
    print(0)
  else:
    if d == 0:
      print(doubling(x, n))
    else:
      if n >= mod:
        print(0)
      else:
        xinvd = x * inved(d) - 1
        xinvd %= mod
        if xinvd + n >= mod:
          print(0)
        else:
          dn = doubling(d, n)
          print((dn * frac[xinvd + n] * inved(frac[xinvd])) % mod)

# Fixed version:
Q = int(input())
mod = int(1e+6 + 3)

def doubling(n, m):
  y = 1
  p = n
  while m != 0:
    if m % 2 == 1:
      y *= p
      y %= mod
    m //= 2
    p *= p
    p %= mod
  return y

def inved(s):
  x, y, u, v, k, l = 1, 0, 0, 1, s, mod
  while l != 0:
    x, y, u, v = u, v, x - u * (k // l), y - v * (k // l)
    k, l = l, k % l
  return x % mod

frac = [1 for _ in range(mod+1)]
invf = [1 for _ in range(mod+1)]
invf[mod] = 0
for i in range(mod):
  frac[i+1] = (frac[i] * (i+1)) % mod
invf[mod-1] = inved(frac[mod-1])
for i in range(mod-1, 0, -1):
  invf[i-1] = (invf[i] * i) % mod

for i in range(Q):
  x, d, n = map(int, input().split())
  if x == 0:
    print(0)
  else:
    if d == 0:
      print(doubling(x, n))
    else:
      if n >= mod:
        print(0)
      else:
        xinvd = x * inved(d) - 1
        xinvd %= mod
        if xinvd + n >= mod:
          print(0)
        else:
          dn = doubling(d, n)
          print((dn * frac[xinvd + n] * invf[xinvd]) % mod)

# Buggy version:
import sys,collections as cl,bisect as bs
sys.setrecursionlimit(100000)
Max = sys.maxsize
def l():
	return list(map(int,input().split()))
def m():
	return map(int,input().split())
def s(x):
	a = []
	aa = x[0]
	su = 1
	for i in range(len(x)-1):
		if aa == x[i+1]:
			a.append([aa,su])
			aa = x[i+1]
			su = 1
		else:
			su += 1
	a.append([aa,su])
	return a
def jo(x):
	return " ".join(map(str,x))

q = m()
mod = 10**6+3
f = {}
f[0] = 1
for i in range(1,p):
	f[i] = d[i-1] * i % mod

for i in range(q):
	x,d,n = m()
	if d == 0:
		ans = pow(x,n,mod)
	else:
		x = x * pow(d,mod-2,mod)%mod
		if mod <= x + n - 1:
			ans = 0
		else:
			ans = pow(d,n,mod) * f[x+n-1] * pow(f[x-1],mod-2,mod) % mod
	print(ans)

# Fixed version:
import sys,collections as cl,bisect as bs
sys.setrecursionlimit(100000)
Max = sys.maxsize
def l():
	return list(map(int,input().split()))
def m():
	return map(int,input().split())
def s(x):
	a = []
	aa = x[0]
	su = 1
	for i in range(len(x)-1):
		if aa == x[i+1]:
			a.append([aa,su])
			aa = x[i+1]
			su = 1
		else:
			su += 1
	a.append([aa,su])
	return a
def jo(x):
	return " ".join(map(str,x))

q = int(input())
mod = 10**6+3
f = {}
f[0] = 1
for i in range(1,mod):
	f[i] = f[i-1] * i % mod

for i in range(q):
	x,d,n = m()
	if d == 0:
		ans = pow(x,n,mod)
	else:
		x = x * pow(d,mod-2,mod)%mod
		if mod <= x + n - 1:
			ans = 0
		else:
			ans = pow(d,n,mod) * f[x+n-1] * pow(f[x-1],mod-2,mod) % mod
	print(ans)

# Buggy version:
mod = 10 ** 6 + 3

W = [1] * (mod)
for i in range(mod - 1):
	W[i + 1] = ((i + 1) * W[i]) % mod

def rev(a):
	return pow(a, mod - 2, mod)

def f(x, d, n):
	if d == 0:
		return pow(x, n, mod)
	else:
		d_r = rev(d)
		xdr = d_r * x % mod
		if xdr == 0:
			return 0
		elif (xdr + n - 1) >= mod:
			return 0
		else:
			return (W[xdr + n - 1] * rev(W[xdr - 1]) % mod) * pow(d, n, mod) % mod

ans = []
q = int(input())
for _ in range(q):
    x,d,n = map(int,input().split())
    ans.append(f(x,d,n))
print("\n".join(ans))


# Fixed version:
mod = 10 ** 6 + 3

W = [1] * (mod)
for i in range(mod - 1):
	W[i + 1] = ((i + 1) * W[i]) % mod

def rev(a):
	return pow(a, mod - 2, mod)

def f(x, d, n):
	if d == 0:
		return pow(x, n, mod)
	else:
		d_r = rev(d)
		xdr = d_r * x % mod
		if xdr == 0:
			return 0
		elif (xdr + n - 1) >= mod:
			return 0
		else:
			return (W[xdr + n - 1] * rev(W[xdr - 1]) % mod) * pow(d, n, mod) % mod

ans = []
q = int(input())
for _ in range(q):
    x,d,n = map(int,input().split())
    ans.append(f(x,d,n))
for i in ans:
    print(i)

# Buggy version:
Q = int(input())

mod = 10 ** 6 + 3
table = [1]
for i in range(1, mod):
    table.append(table[-1]*i % mod)

for i in range(Q):
    x, d, n = map(int, input().split())
    if d == 0:
        print(pow(x, n, mod))
    else:
        print(pow(d, n, mod) * table[y + n - 1] * pow(table[y - 1], mod - 2, mod) % mod)

# Fixed version:
Q = int(input())

mod = 10 ** 6 + 3
table = [1]
for i in range(1, mod):
    table.append(table[-1]*i % mod)

for i in range(Q):
    x, d, n = map(int, input().split())
    if d == 0:
        print(pow(x, n, mod))
    else:
        y = x * pow(d, mod - 2, mod) % mod
        if y + n - 1 >= mod:
            print(0)
        else:
            print(pow(d, n, mod) * table[y + n - 1] * pow(table[y - 1], mod - 2, mod) % mod)