#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll M = 1e6+3;
inline ll mul(ll a, ll b) {return (a*b)%M;}
ll bp(ll b, ll p) {
	ll ac = 1;
	while(p) {
		if(p&1) {
			ac = mul(ac,b);
		}
		b = mul(b,b);
		p >>= 1;
	}
	return ac;
}
ll fac[M+10];
void pre() {
	ll rs = 1;
	fac[0] = rs;
	for(int i=1;i<M;i++) {
		rs = mul(rs,i);
		fac[i] = rs;
	}
}
inline ll inv(ll v) {
	return bp(v,M-2);
}
ll fa(ll v, ll d) {
	if(v >= M) {return 0;}
	return mul(bp(d,v),fac[v]);
}
ll solve(ll x, ll d, ll n) {
	if(d == 0) {
		return bp(x,n);
	}
	if(x == 0) return 0;
	ll id = mul(x,inv(d));
	id = (id+M-1)%M;
	return mul(inv(fa(id,d)),fa(id+n,d));
}
int main() {
	ios::sync_with_stdio(0);
	ll q;
	cin >> q;
	pre();
	while(q--) {
		ll a,b,c;
		cin >> a >> b >> c;
		cout << solve(a,b,c) << '\n';
	}
}