#include<cstdio>
#include<algorithm>
using namespace std;
int n;
long long A, B, C, Mod = 1000003, F[1010000], InvF[1010000];
long long PA, PB;
long long Pow(long long a, long long b) {
	long long r = 1;
	while (b) {
		if (b & 1)r = r * a%Mod;
		a = a * a%Mod; b >>= 1;
	}
	return r;
}
long long Inv(long long a) {
	return Pow(a, Mod - 2);
}
long long Comb(int a, int b) {
	if (b < 0 || a < b)return 0;
	return F[a] * InvF[b] % Mod*InvF[a - b] % Mod;
}
long long Prob(int a, int b) {
	return Pow(PA, a)*Pow(PB, b) % Mod*Comb(a + b, a) % Mod;
}
void Solve(int x, int d, int n) {
	if (d == 0) {
		printf("%lld\n", Pow(x, n));
		return;
	}
	long long t = x * Inv(d)%Mod;
	if (t == 0 || t + n - 1 >= Mod) {
		puts("0");
		return;
	}
	printf("%lld\n", F[t + n - 1] * InvF[t - 1] % Mod * Pow(d, n) % Mod);
}
int main() {
	int i, Q;
	scanf("%d", &Q);
	int n, x, d;
	F[0] = 1;
	for (i = 1; i < Mod; i++)F[i] = F[i - 1] * i%Mod;
	InvF[Mod-1] = Inv(F[Mod-1]);
	for (i = Mod-1; i >= 1; i--)InvF[i - 1] = InvF[i] * i%Mod;

	while (Q--) {
		scanf("%d%d%d", &x, &d, &n);
		Solve(x, d, n);
	}
}
### Prompt

Please create a solution in cpp to the following problem:

Consider the following arithmetic progression with n terms:

* x, x + d, x + 2d, \ldots, x + (n-1)d



What is the product of all terms in this sequence? Compute the answer modulo 1\ 000\ 003.

You are given Q queries of this form. In the i-th query, compute the answer in case x = x_i, d = d_i, n = n_i.

Constraints

* 1 \leq Q \leq 10^5
* 0 \leq x_i, d_i \leq 1\ 000\ 002
* 1 \leq n_i \leq 10^9
* All values in input are integers.

Input

Input is given from Standard Input in the following format:


Q
x_1 d_1 n_1
:
x_Q d_Q n_Q


Output

Print Q lines.

In the i-th line, print the answer for the i-th query.

Example

Input

2
7 2 4
12345 67890 2019


Output

9009
916936

### Response

```cpp
#include<cstdio>
#include<algorithm>
using namespace std;
int n;
long long A, B, C, Mod = 1000003, F[1010000], InvF[1010000];
long long PA, PB;
long long Pow(long long a, long long b) {
	long long r = 1;
	while (b) {
		if (b & 1)r = r * a%Mod;
		a = a * a%Mod; b >>= 1;
	}
	return r;
}
long long Inv(long long a) {
	return Pow(a, Mod - 2);
}
long long Comb(int a, int b) {
	if (b < 0 || a < b)return 0;
	return F[a] * InvF[b] % Mod*InvF[a - b] % Mod;
}
long long Prob(int a, int b) {
	return Pow(PA, a)*Pow(PB, b) % Mod*Comb(a + b, a) % Mod;
}
void Solve(int x, int d, int n) {
	if (d == 0) {
		printf("%lld\n", Pow(x, n));
		return;
	}
	long long t = x * Inv(d)%Mod;
	if (t == 0 || t + n - 1 >= Mod) {
		puts("0");
		return;
	}
	printf("%lld\n", F[t + n - 1] * InvF[t - 1] % Mod * Pow(d, n) % Mod);
}
int main() {
	int i, Q;
	scanf("%d", &Q);
	int n, x, d;
	F[0] = 1;
	for (i = 1; i < Mod; i++)F[i] = F[i - 1] * i%Mod;
	InvF[Mod-1] = Inv(F[Mod-1]);
	for (i = Mod-1; i >= 1; i--)InvF[i - 1] = InvF[i] * i%Mod;

	while (Q--) {
		scanf("%d%d%d", &x, &d, &n);
		Solve(x, d, n);
	}
}
```