Q = int(eval(input()))

mod = 10**6+3

arr = []

for i in range(Q):

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

    arr.append([x, d, n])



P = [1]*(mod+1)

for i in range(mod):

    P[i+1] = P[i]*(i+1)%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)

        if d_r * x % mod == 0:

            return 0

        elif (d_r*x%mod+n-1) >= mod:

            return 0

        else:

            return (P[d_r*x%mod+n-1] * rev(P[d_r*x%mod-1])%mod)*pow(d,n,mod)%mod



for i in range(Q):

    print((f(arr[i][0], arr[i][1], arr[i][2])))

Q = int(eval(input()))

mod = 10**6+3

arr = []

for i in range(Q):

    arr.append(list(map(int, input().split())))



P = [1]*(mod+1)

for i in range(mod):

    P[i+1] = P[i]*(i+1)%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 (P[xdr+n-1] * rev(P[xdr-1])%mod) * pow(d,n,mod)%mod



for i in range(Q):

    print((f(arr[i][0], arr[i][1], arr[i][2])))
Q = int(eval(input()))
mod = 10**6 + 3
arr = []
for i in range(Q):
    x, d, n = list(map(int, input().split()))
    arr.append([x, d, n])
P = [1] * (mod + 1)
for i in range(mod):
    P[i + 1] = P[i] * (i + 1) % 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)
        if d_r * x % mod == 0:
            return 0
        elif (d_r * x % mod + n - 1) >= mod:
            return 0
        else:
            return (
                (P[d_r * x % mod + n - 1] * rev(P[d_r * x % mod - 1]) % mod)
                * pow(d, n, mod)
                % mod
            )


for i in range(Q):
    print((f(arr[i][0], arr[i][1], arr[i][2])))

Q = int(eval(input()))
mod = 10**6 + 3
arr = []
for i in range(Q):
    arr.append(list(map(int, input().split())))
P = [1] * (mod + 1)
for i in range(mod):
    P[i + 1] = P[i] * (i + 1) % 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 (P[xdr + n - 1] * rev(P[xdr - 1]) % mod) * pow(d, n, mod) % mod


for i in range(Q):
    print((f(arr[i][0], arr[i][1], arr[i][2])))

-    x, d, n = list(map(int, input().split())) -    arr.append([x, d, n]) +    arr.append(list(map(int, input().split()))) -        if d_r * x % mod == 0: +        xdr = d_r * x % mod +        if xdr == 0: -        elif (d_r * x % mod + n - 1) >= mod: +        elif (xdr + n - 1) >= mod: -            return ( -                (P[d_r * x % mod + n - 1] * rev(P[d_r * x % mod - 1]) % mod) -                * pow(d, n, mod) -                % mod -            ) +            return (P[xdr + n - 1] * rev(P[xdr - 1]) % mod) * pow(d, n, mod) % mod