#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<numeric>
#include<cstring>
#include<cstdio>
#include<functional>
#include<bitset>
#include<limits.h>
#include<cassert>
#include <fstream>
#include <time.h>
#include <iterator>


#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define REVERSE(v,n) reverse(v,v+n);
#define VREVERSE(v) reverse(v.begin(), v.end());
#define ll long long
#define pb(a) push_back(a)
#define m0(x) memset(x,0,sizeof(x))
#define print(x) cout<<x<<endl;
#define pe(x) cout<<x<<" ";
#define lb(v,n) lower_bound(v.begin(), v.end(), n);
#define ub(v,n) upper_bound(v.begin(), v.end(), n);
#define int long long
#define all(x) (x).begin(), (x).end()

using namespace std;

const int MOD = 1000003;
const ll INF = 1e17;
const double pi = acos(-1);
const double EPS = 1e-10;
typedef pair<int, int>P;
const int MAX = 1000003;

long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for (int i = 2; i < MAX; i++) {
		fac[i] = fac[i - 1] * i % MOD;
		inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
		finv[i] = finv[i - 1] * inv[i] % MOD;
	}
}

// 二項係数計算
long long COM(int n, int k) {
	if (n < k) return 0;
	if (n < 0 || k < 0) return 0;
	return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

long long power_mod(long long x, long long n, long long m) {
	if (n == 0)
		return 1;
	if (n % 2 == 0)
		return power_mod(x * x % m, n / 2, m);
	else
		return x * power_mod(x, n - 1, m) % m;
}
ll add(ll x, ll y) {
	x += y;
	if (x >= MOD) return x - MOD;
	return x;
}
ll sub(ll x, ll y) {
	x -= y;
	if (x < 0) return x + MOD;
	return x;
}
ll mult(ll x, ll y) {
	return (x * y) % MOD;
}
ll bin_pow(ll x, ll p) {
	if (p == 0) return 1;
	if (p & 1) return mult(x, bin_pow(x, p - 1));
	return bin_pow(mult(x, x), p / 2);
}
int x[100010], d[100010], n[100010];
ll check(int x, int d, int n) {
	ll res = 1;
	for (int i = 0; i < n; i++) {
		//pe(x + d * i); print((x + d * i) % MOD);
		//if ((x + d * i) % MOD == 0)break;
		res *= ((x + d * i) % MOD);
		res %= MOD;
	}
	return res;
}

bool judge(ll a, ll b) {
	ll k = a / MOD;
	ll a2 = a - k * MOD, b2 = b - k * MOD;
	if (b2 >= MOD) {
		return true;
	}
	else return false;
}

signed main() {
	/*cin.tie(0);
	ios::sync_with_stdio(false);*/
	int Q; cin >> Q;
	REP(i, Q) {
		cin >> x[i] >> d[i] >> n[i];
	}
	COMinit();
	REP(i, Q) {
		if (d[i] == 0) {
			ll ans = bin_pow(x[i], n[i]);
			if (ans < 0)return 1;
			print(ans);
			continue;
		}
		ll ans = bin_pow(d[i], n[i]);
		if (ans >MOD)return 1;
		ll p = mult(x[i], inv[d[i]]);
		if (p >MOD)return 1;
		if (judge(p, p + n[i] - 1)) {
			print(0);
			continue;
		}
		ll res1 = fac[(p + n[i] - 1 + MOD) % MOD];
		if (res1 >MOD)return 1;
		res1 = mult(res1, finv[(p - 1 + MOD) % MOD]);
		if (res1 >MOD)return 1;
		ans = mult(ans, res1);
		if (ans >MOD)return 1;

		print(ans % MOD);
		//print(check(x[i], d[i], n[i]));
	}
}


Measured memory_bytes: 26624