#include <bits/stdc++.h>
using namespace std;
#define int long long
const int MOD=1000003;

/*
d==0ならpw(x,n)を求めればいいからO(n logn)
d!=0ならn>=MODの時はx+(n-1)dが0になる時があるのでO(1)
d!=0&&n<MODの時は？愚直に計算したら結局O(Q MOD)で間に合わない
*/
int w[1234567];
int pw(int n,int k){
  if(k<0)return pw(n,k+MOD-1);
  int res=1;
  while(k){
    if(k&1)res*=n;res%=MOD;
    n*=n;n%=MOD;
    k>>=1;
  }
  return res;
}
int g(int a,int n){
  if(a+n-1>=MOD)return 0;
  return w[a+n-1]*pw(w[a-1],MOD-2)%MOD;
}
int f(int x,int d,int n){
  if(d==0)return pw(x,n);
  if(n>=MOD)return 0;
  int D=pw(d,MOD-2);
  int res=pw(d,n);
  res*=g(D*x%MOD,n);
  return res%MOD;
}

signed main(){
  int Q;cin>>Q;
  vector<int> x(Q),d(Q),n(Q);
  w[1]=1;
  for(int i=2;i<=MOD;i++)w[i]=w[i-1]*i%MOD;
  for(int i=0;i<Q;i++)cin>>x[i]>>d[i]>>n[i];
  for(int i=0;i<Q;i++)cout<<f(x[i],d[i],n[i])<<endl;
}

### Prompt

Generate 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>
using namespace std;
#define int long long
const int MOD=1000003;

/*
d==0ならpw(x,n)を求めればいいからO(n logn)
d!=0ならn>=MODの時はx+(n-1)dが0になる時があるのでO(1)
d!=0&&n<MODの時は？愚直に計算したら結局O(Q MOD)で間に合わない
*/
int w[1234567];
int pw(int n,int k){
  if(k<0)return pw(n,k+MOD-1);
  int res=1;
  while(k){
    if(k&1)res*=n;res%=MOD;
    n*=n;n%=MOD;
    k>>=1;
  }
  return res;
}
int g(int a,int n){
  if(a+n-1>=MOD)return 0;
  return w[a+n-1]*pw(w[a-1],MOD-2)%MOD;
}
int f(int x,int d,int n){
  if(d==0)return pw(x,n);
  if(n>=MOD)return 0;
  int D=pw(d,MOD-2);
  int res=pw(d,n);
  res*=g(D*x%MOD,n);
  return res%MOD;
}

signed main(){
  int Q;cin>>Q;
  vector<int> x(Q),d(Q),n(Q);
  w[1]=1;
  for(int i=2;i<=MOD;i++)w[i]=w[i-1]*i%MOD;
  for(int i=0;i<Q;i++)cin>>x[i]>>d[i]>>n[i];
  for(int i=0;i<Q;i++)cout<<f(x[i],d[i],n[i])<<endl;
}

```