#include<bits/stdc++.h>
using namespace std;
const int mod=1000003;
int add(int a,int b){
    a+=b; return a>=mod?a-mod:mod;
}
int sub(int a,int b){
    a-=b; return a<0?a+mod:a;
}
int mul(int a,int b){
    return (int)((1ll*a*b)%mod);
}
int power(int a,int b){
    int res=1;
    while(b>0){
        if(b&1){
            res=mul(res,a);
        }
        a=mul(a,a);
        b>>=1;
    }
    return res;
}
int t,n,x,y,d,pre[mod+5];

int main(){
    scanf("%d",&t);
    pre[1]=1;
    for(int i=2;i<mod;i++){
        pre[i]=mul(pre[i-1],i);
    }
    int s;
    while(t--){
        scanf("%d%d%d",&x,&d,&n);
        if(d==0){
            printf("%d\n",power(x,n));
            continue;
        }
        int ans=1;
        ans=mul(ans,power(d,n));
        s=mul(x,power(d,mod-2));
        if(s+(n-1)>=mod){
            printf("0\n");
            continue;
        }
        if(s==1){
            printf("%d\n",mul(ans,pre[s+n-1]));
            continue;
        }
        printf("%d\n",mul(ans,mul(pre[s+n-1],power(pre[s-1],mod-2))));
        //product from x(x+d)...(x+(n-1)*d)
        //d^n (x/d)(x/d+1)....(x/d+(n-1))
    }

}

### 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
#include<bits/stdc++.h>
using namespace std;
const int mod=1000003;
int add(int a,int b){
    a+=b; return a>=mod?a-mod:mod;
}
int sub(int a,int b){
    a-=b; return a<0?a+mod:a;
}
int mul(int a,int b){
    return (int)((1ll*a*b)%mod);
}
int power(int a,int b){
    int res=1;
    while(b>0){
        if(b&1){
            res=mul(res,a);
        }
        a=mul(a,a);
        b>>=1;
    }
    return res;
}
int t,n,x,y,d,pre[mod+5];

int main(){
    scanf("%d",&t);
    pre[1]=1;
    for(int i=2;i<mod;i++){
        pre[i]=mul(pre[i-1],i);
    }
    int s;
    while(t--){
        scanf("%d%d%d",&x,&d,&n);
        if(d==0){
            printf("%d\n",power(x,n));
            continue;
        }
        int ans=1;
        ans=mul(ans,power(d,n));
        s=mul(x,power(d,mod-2));
        if(s+(n-1)>=mod){
            printf("0\n");
            continue;
        }
        if(s==1){
            printf("%d\n",mul(ans,pre[s+n-1]));
            continue;
        }
        printf("%d\n",mul(ans,mul(pre[s+n-1],power(pre[s-1],mod-2))));
        //product from x(x+d)...(x+(n-1)*d)
        //d^n (x/d)(x/d+1)....(x/d+(n-1))
    }

}

```