mod = 10 ** 6 + 3



W = [1]

for i in range(1, mod):

	W.append((W[-1] * 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



Q = int(eval(input()))

for i in range(Q):

	x, d, n = list(map(int, input().split()))

	print((f(x, d, n)))

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(eval(input()))

for _ in range(q):

    x,d,n = list(map(int,input().split()))

    ans.append(f(x,d,n))

for i in ans:

    print(i)
mod = 10**6 + 3
W = [1]
for i in range(1, mod):
    W.append((W[-1] * 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


Q = int(eval(input()))
for i in range(Q):
    x, d, n = list(map(int, input().split()))
    print((f(x, d, n)))

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(eval(input()))
for _ in range(q):
    x, d, n = list(map(int, input().split()))
    ans.append(f(x, d, n))
for i in ans:
    print(i)

-W = [1] -for i in range(1, mod): -    W.append((W[-1] * i) % mod) +W = [1] * (mod) +for i in range(mod - 1): +    W[i + 1] = ((i + 1) * W[i]) % mod -Q = int(eval(input())) -for i in range(Q): +ans = [] +q = int(eval(input())) +for _ in range(q): -    print((f(x, d, n))) +    ans.append(f(x, d, n)) +for i in ans: +    print(i)