//by xxj
#include<bits/stdc++.h>
using namespace std;
#define fst first
#define snd second
#define mp make_pair
#define ll long long
#define pii pair<int,int>
#define lowbit(x) x&-x
const int inf=1e9+7;
const double eps=1e-10;
const ll linf=1e18+7;
const ll hh=523;
const int mod=1000003;
const int maxn=1000002;
int jc[1000007],njc[1000007],ny[1000007];
int qsm(int a,int c){
	int re=1;
	while (c!=0){
		if (c%2==1){
			re=1ll*re*a%mod;
		}
		a=1ll*a*a%mod;
		c/=2;
	}
	return re;
}
void init(){
	jc[0]=1;
	for (int i=1;i<=maxn;i++){
		jc[i]=1ll*jc[i-1]*i%mod;
//		cout<<i<<' '<<jc[i]<<endl;
	}
	njc[maxn]=qsm(jc[maxn],mod-2);
//	cout<<jc[maxn-1]<<endl;
	for (int i=maxn-1;i>=0;i--){
		ny[i+1]=1ll*njc[i+1]*jc[i]%mod;
		njc[i]=1ll*njc[i+1]*(i+1)%mod;
	}
}
int main(){
	//freopen(".in","r",stdin);
	//freopen(".out","w",stdout);
	init();
	int q;
	scanf("%d",&q);
	int x,d,n;
	while (q--){
		scanf("%d%d%d",&x,&d,&n);
		int k=1ll*x*ny[d]%mod;
		if (d==0){
			printf("%d\n",qsm(x,n));
			continue;
		}
		if (k==0 || k+n-1>=mod){
			puts("0");
			continue;
		}
		if (k==1){
			printf("%d\n",1ll*jc[k+n-1]*qsm(d,n)%mod);
			continue;
		}
		printf("%d\n",1ll*jc[k+n-1]*njc[k-1]%mod*qsm(d,n)%mod);
	}
	return 0;
}
/*
input:
*/

### Prompt

In Cpp, your task is to solve 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
//by xxj
#include<bits/stdc++.h>
using namespace std;
#define fst first
#define snd second
#define mp make_pair
#define ll long long
#define pii pair<int,int>
#define lowbit(x) x&-x
const int inf=1e9+7;
const double eps=1e-10;
const ll linf=1e18+7;
const ll hh=523;
const int mod=1000003;
const int maxn=1000002;
int jc[1000007],njc[1000007],ny[1000007];
int qsm(int a,int c){
	int re=1;
	while (c!=0){
		if (c%2==1){
			re=1ll*re*a%mod;
		}
		a=1ll*a*a%mod;
		c/=2;
	}
	return re;
}
void init(){
	jc[0]=1;
	for (int i=1;i<=maxn;i++){
		jc[i]=1ll*jc[i-1]*i%mod;
//		cout<<i<<' '<<jc[i]<<endl;
	}
	njc[maxn]=qsm(jc[maxn],mod-2);
//	cout<<jc[maxn-1]<<endl;
	for (int i=maxn-1;i>=0;i--){
		ny[i+1]=1ll*njc[i+1]*jc[i]%mod;
		njc[i]=1ll*njc[i+1]*(i+1)%mod;
	}
}
int main(){
	//freopen(".in","r",stdin);
	//freopen(".out","w",stdout);
	init();
	int q;
	scanf("%d",&q);
	int x,d,n;
	while (q--){
		scanf("%d%d%d",&x,&d,&n);
		int k=1ll*x*ny[d]%mod;
		if (d==0){
			printf("%d\n",qsm(x,n));
			continue;
		}
		if (k==0 || k+n-1>=mod){
			puts("0");
			continue;
		}
		if (k==1){
			printf("%d\n",1ll*jc[k+n-1]*qsm(d,n)%mod);
			continue;
		}
		printf("%d\n",1ll*jc[k+n-1]*njc[k-1]%mod*qsm(d,n)%mod);
	}
	return 0;
}
/*
input:
*/

```