#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math")
#include <bits/stdc++.h>
using namespace std;
template<class t> inline t read(t &x){
	char c=getchar();bool f=0;x=0;
	while(!isdigit(c)) f|=c=='-',c=getchar();
	while(isdigit(c)) x=(x<<1)+(x<<3)+(c^48),c=getchar();
	if(f) x=-x;return x;
}
template<class t,class ...A> inline void read(t &x,A &...a){
	read(x);read(a...);
}
template<class t> inline void write(t x){
	if(x<0) putchar('-'),write(-x);
	else{if(x>9) write(x/10);putchar('0'+x%10);}
}

const int mod=1e6+3,N=1e6+5;
int fac[N],inv[N];

int fpow(int x,int y){
	int res=1;
	for(;y;y>>=1,x=1ll*x*x%mod) if(y&1) res=1ll*res*x%mod;
	return res;
}

void doit(){
	int x,d,n;
	read(x,d,n);
	if(!d){
		write(fpow(x,n));
		return ;
	}
	x=1ll*x*fpow(d,mod-2)%mod;
	if(x<=0||x+n-1>=mod) write(0);
	else write(1ll*fac[x+n-1]*inv[x-1]%mod*fpow(d,n)%mod);
}

signed main(){
	fac[0]=inv[0]=1;for(int i=1;i<mod;i++) fac[i]=1ll*fac[i-1]*i%mod,inv[i]=fpow(fac[i],mod-2);
	int t;
	read(t);
	while(t--) doit(),puts("");
}
### Prompt

Please provide a CPP coded solution to the problem described below:

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
#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math")
#include <bits/stdc++.h>
using namespace std;
template<class t> inline t read(t &x){
	char c=getchar();bool f=0;x=0;
	while(!isdigit(c)) f|=c=='-',c=getchar();
	while(isdigit(c)) x=(x<<1)+(x<<3)+(c^48),c=getchar();
	if(f) x=-x;return x;
}
template<class t,class ...A> inline void read(t &x,A &...a){
	read(x);read(a...);
}
template<class t> inline void write(t x){
	if(x<0) putchar('-'),write(-x);
	else{if(x>9) write(x/10);putchar('0'+x%10);}
}

const int mod=1e6+3,N=1e6+5;
int fac[N],inv[N];

int fpow(int x,int y){
	int res=1;
	for(;y;y>>=1,x=1ll*x*x%mod) if(y&1) res=1ll*res*x%mod;
	return res;
}

void doit(){
	int x,d,n;
	read(x,d,n);
	if(!d){
		write(fpow(x,n));
		return ;
	}
	x=1ll*x*fpow(d,mod-2)%mod;
	if(x<=0||x+n-1>=mod) write(0);
	else write(1ll*fac[x+n-1]*inv[x-1]%mod*fpow(d,n)%mod);
}

signed main(){
	fac[0]=inv[0]=1;for(int i=1;i<mod;i++) fac[i]=1ll*fac[i-1]*i%mod,inv[i]=fpow(fac[i],mod-2);
	int t;
	read(t);
	while(t--) doit(),puts("");
}
```