using
System;
using
System.Linq;
using
System.Collections.Generic;
public
class
GFG {
public
const
long
MOD = (
long
)1e9 + 7;
static
long
power(
long
x,
long
y,
long
M)
{
if
(y == 0)
return
1;
long
p = power(x, y / 2, M) % M;
p = (p * p) % M;
return
(y % 2 == 0) ? p : (x * p) % M;
}
static
long
modInverse(
long
A,
long
M)
{
return
power(A, M - 2, M);
}
static
void
findWays(
int
[, ] Q,
int
M)
{
long
[] fact =
new
long
[100001];
fact[1] = 1;
for
(
int
i = 2; i <= 1e5; i++) {
fact[i] = (fact[i - 1] * i) % MOD;
}
for
(
int
i = 0; i < M; i++) {
int
X = Q[i, 0], Y = Q[i, 1], Z = Q[i, 2];
long
ans = (fact[X + Y + Z]
* modInverse(fact[X], MOD))
% MOD;
ans = (ans * modInverse(fact[Y], MOD)) % MOD;
ans = (ans * modInverse(fact[Z], MOD)) % MOD;
Console.Write(ans - 6 +
" "
);
}
Console.WriteLine();
}
static
public
void
Main()
{
int
[, ] Q
= { { 1, 1, 1 }, { 1, 2, 1 }, { 2, 2, 1 } };
int
N = 3;
findWays(Q, N);
int
[, ] Q1
= { { 2, 3, 5 }, { 5, 6, 7 }, { 8, 9, 10 } };
int
N1 = 3;
findWays(Q1, N1);
}
}