#include <bits/stdc++.h>

#define pb push_back
#define F first
#define S second
#define all(x) x.begin(), x.end()
#define debug(x)  cerr << #x << " = " << x << endl

using namespace std;

typedef long long ll;
typedef string str;

const ll MAXN = 1e6 + 10;
const ll MOD = 1e6 + 3;

ll mul(ll a, ll b){
	return (a * b) % MOD;
}
ll pw(ll b, ll P){
	if(P == 0) return 1;
	if(P & 1) return mul(b, pw(b, P ^ 1));
	return pw(mul(b, b), P >> 1);
}
ll f[MAXN], iv[MAXN];
ll nCr(ll n, ll r){
	return mul(f[n], mul(iv[r], iv[n - r]));
}
ll inv(ll x){
	return pw(x, MOD - 2);
}

ll ans = 0;

ll mult(ll l, ll n){
	//debug(l); debug(n);
	if(l == 0) return 0;
	if(l + n > MOD) return 0;
	//debug(mul(f[l + n - 1], iv[l - 1]));
	return mul(f[l + n - 1], iv[l - 1]);
}

ll calc(ll x, ll d, ll n){
	if(d == 0) return pw(x, n);
	return mul( pw(d, n), mult( mul(x, inv(d)), n ));
}

int main(){
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	f[0] = 1;
	for(int i = 1; i < MAXN; i++) f[i] = mul(f[i - 1], i);
	iv[MOD - 1] = pw(f[MOD - 1], MOD - 2);
	for(int i = MOD - 2; i >= 0; i--) iv[i] = mul(iv[i + 1], i + 1);
	ll Q;
	cin >> Q;
	ll a, b, c;
	for(int i = 0; i < Q;i++){
		cin >>a >> b>>c;
		cout << calc(a,b,c) << '\n';
	}
	return 0;
}


### Prompt

Your challenge is to write a Cpp solution 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 <bits/stdc++.h>

#define pb push_back
#define F first
#define S second
#define all(x) x.begin(), x.end()
#define debug(x)  cerr << #x << " = " << x << endl

using namespace std;

typedef long long ll;
typedef string str;

const ll MAXN = 1e6 + 10;
const ll MOD = 1e6 + 3;

ll mul(ll a, ll b){
	return (a * b) % MOD;
}
ll pw(ll b, ll P){
	if(P == 0) return 1;
	if(P & 1) return mul(b, pw(b, P ^ 1));
	return pw(mul(b, b), P >> 1);
}
ll f[MAXN], iv[MAXN];
ll nCr(ll n, ll r){
	return mul(f[n], mul(iv[r], iv[n - r]));
}
ll inv(ll x){
	return pw(x, MOD - 2);
}

ll ans = 0;

ll mult(ll l, ll n){
	//debug(l); debug(n);
	if(l == 0) return 0;
	if(l + n > MOD) return 0;
	//debug(mul(f[l + n - 1], iv[l - 1]));
	return mul(f[l + n - 1], iv[l - 1]);
}

ll calc(ll x, ll d, ll n){
	if(d == 0) return pw(x, n);
	return mul( pw(d, n), mult( mul(x, inv(d)), n ));
}

int main(){
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	f[0] = 1;
	for(int i = 1; i < MAXN; i++) f[i] = mul(f[i - 1], i);
	iv[MOD - 1] = pw(f[MOD - 1], MOD - 2);
	for(int i = MOD - 2; i >= 0; i--) iv[i] = mul(iv[i + 1], i + 1);
	ll Q;
	cin >> Q;
	ll a, b, c;
	for(int i = 0; i < Q;i++){
		cin >>a >> b>>c;
		cout << calc(a,b,c) << '\n';
	}
	return 0;
}


```