#include <bits/stdc++.h>
#define int long long
using namespace std;
const int mod = 1e9 + 7;
int32_t main()
{
int T;
cin >> T;
while (T--)
{
int n1, n2, k1, k2;
cin >> n1 >> n2 >> k1;
k2 = k1;
vector<vector<vector<vector<int>>>> dp(n1 + 1, vector<vector<vector<int>>>(n2 + 1, vector<vector<int>>(max(k1, k2) + 1, vector<int>(2, 0))));
dp[0][0][0][1] = 1;
dp[0][0][0][0] = 1;
for (int i = 0; i <= n1; i++)
{
for (int j = 0; j <= n2; j++)
{
for (int k = 0; k <= k2; k++)
if (j >= k && i - 1 >= 0)
dp[i][j][1][0] += dp[i - 1][j][k][1], dp[i][j][1][0] %= mod;
for (int k = 0; k <= k1; k++)
if (i >= k && j - 1 >= 0)
dp[i][j][1][1] += dp[i][j - 1][k][0], dp[i][j][1][1] %= mod;
for (int rep = 2; rep <= k1; rep++)
{
if (i - 1 >= 0 && i >= rep)
dp[i][j][rep][0] += dp[i - 1][j][rep - 1][0], dp[i][j][rep][0] %= mod;
}
for (int rep = 2; rep <= k2; rep++)
{
if (j - 1 >= 0 && j >= rep)
dp[i][j][rep][1] += dp[i][j - 1][rep - 1][1], dp[i][j][rep][1] %= mod;
}
}
}
int ans = 0;
for (int i = 0; i <= n1; i++)
{
for (int j = 0; j <= n2; j++)
{
if (i + j == n1 + n2)
{
for (int k = 0; k <= max(k1, k2); k++)
{
ans += dp[i][j][k][0];
ans %= mod;
ans += dp[i][j][k][1];
ans %= mod;
}
}
}
}
cout << ans << "\n";
}
return 0;
}
I2luY2x1ZGUgPGJpdHMvc3RkYysrLmg+CiNkZWZpbmUgaW50IGxvbmcgbG9uZwp1c2luZyBuYW1lc3BhY2Ugc3RkOwpjb25zdCBpbnQgbW9kID0gMWU5ICsgNzsKaW50MzJfdCBtYWluKCkKewogICAgaW50IFQ7CiAgICBjaW4gPj4gVDsKICAgIHdoaWxlIChULS0pCiAgICB7CiAgICAgICAgaW50IG4xLCBuMiwgazEsIGsyOwogICAgICAgIGNpbiA+PiBuMSA+PiBuMiA+PiBrMTsKICAgICAgICBrMiA9IGsxOwoKICAgICAgICB2ZWN0b3I8dmVjdG9yPHZlY3Rvcjx2ZWN0b3I8aW50Pj4+PiBkcChuMSArIDEsIHZlY3Rvcjx2ZWN0b3I8dmVjdG9yPGludD4+PihuMiArIDEsIHZlY3Rvcjx2ZWN0b3I8aW50Pj4obWF4KGsxLCBrMikgKyAxLCB2ZWN0b3I8aW50PigyLCAwKSkpKTsKICAgICAgICBkcFswXVswXVswXVsxXSA9IDE7CiAgICAgICAgZHBbMF1bMF1bMF1bMF0gPSAxOwoKICAgICAgICBmb3IgKGludCBpID0gMDsgaSA8PSBuMTsgaSsrKSAKICAgICAgICB7CiAgICAgICAgICAgIGZvciAoaW50IGogPSAwOyBqIDw9IG4yOyBqKyspIAogICAgICAgICAgICB7CiAgICAgICAgICAgICAgICBmb3IgKGludCBrID0gMDsgayA8PSBrMjsgaysrKQogICAgICAgICAgICAgICAgICAgIGlmIChqID49IGsgJiYgaSAtIDEgPj0gMCkKICAgICAgICAgICAgICAgICAgICAgICAgZHBbaV1bal1bMV1bMF0gKz0gZHBbaSAtIDFdW2pdW2tdWzFdLCBkcFtpXVtqXVsxXVswXSAlPSBtb2Q7CgogICAgICAgICAgICAgICAgZm9yIChpbnQgayA9IDA7IGsgPD0gazE7IGsrKykgCiAgICAgICAgICAgICAgICAgICAgaWYgKGkgPj0gayAmJiBqIC0gMSA+PSAwKQogICAgICAgICAgICAgICAgICAgICAgICBkcFtpXVtqXVsxXVsxXSArPSBkcFtpXVtqIC0gMV1ba11bMF0sIGRwW2ldW2pdWzFdWzFdICU9IG1vZDsKCiAgICAgICAgICAgICAgICBmb3IgKGludCByZXAgPSAyOyByZXAgPD0gazE7IHJlcCsrKQogICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgIGlmIChpIC0gMSA+PSAwICYmIGkgPj0gcmVwKQogICAgICAgICAgICAgICAgICAgICAgICBkcFtpXVtqXVtyZXBdWzBdICs9IGRwW2kgLSAxXVtqXVtyZXAgLSAxXVswXSwgZHBbaV1bal1bcmVwXVswXSAlPSBtb2Q7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmb3IgKGludCByZXAgPSAyOyByZXAgPD0gazI7IHJlcCsrKQogICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgIGlmIChqIC0gMSA+PSAwICYmIGogPj0gcmVwKQogICAgICAgICAgICAgICAgICAgICAgICBkcFtpXVtqXVtyZXBdWzFdICs9IGRwW2ldW2ogLSAxXVtyZXAgLSAxXVsxXSwgZHBbaV1bal1bcmVwXVsxXSAlPSBtb2Q7CiAgICAgICAgICAgICAgICB9CgogICAgICAgICAgICB9CiAgICAgICAgfQoKICAgICAgICBpbnQgYW5zID0gMDsKICAgICAgICBmb3IgKGludCBpID0gMDsgaSA8PSBuMTsgaSsrKQogICAgICAgIHsKICAgICAgICAgICAgZm9yIChpbnQgaiA9IDA7IGogPD0gbjI7IGorKykKICAgICAgICAgICAgewogICAgICAgICAgICAgICAgaWYgKGkgKyBqID09IG4xICsgbjIpCiAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgZm9yIChpbnQgayA9IDA7IGsgPD0gbWF4KGsxLCBrMik7IGsrKykKICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgIGFucyArPSBkcFtpXVtqXVtrXVswXTsKICAgICAgICAgICAgICAgICAgICAgICAgYW5zICU9IG1vZDsKICAgICAgICAgICAgICAgICAgICAgICAgYW5zICs9IGRwW2ldW2pdW2tdWzFdOwogICAgICAgICAgICAgICAgICAgICAgICBhbnMgJT0gbW9kOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfQogICAgICAgIH0KICAgICAgICBjb3V0IDw8IGFucyA8PCAiXG4iOwogICAgfQogICAgcmV0dXJuIDA7Cn0=