MOD = 1000000007 $dp = 222.times.map { 222.times.map { nil } } def rec a, b $dp[a][b] ||= [a, b].min == 1 ? 1 : rec(a, b-1) + rec(a-1, b) % MOD end n = gets raise unless n =~ /^[1-9][0-9]*$/ n = n.to_i raise unless n.between?(1, 10) n.times do abc = gets raise unless abc =~ /^[1-9][0-9]* [1-9][0-9]* [1-9][0-9]*$/ a, b, c = abc.split.map &:to_i raise unless a.between?(1, 100) raise unless b.between?(1, 100) raise unless c.between?(1, 100) raise unless a.between?(1, b + c - 1) raise unless b.between?(1, c + a - 1) raise unless c.between?(1, a + b - 1) # ans = 0 # a.times { |i| b.times { |j| c.times { |k| # ans += rec(a - i, j + 1) * # rec(b - j, k + 1) * # rec(c - k, i + 1) # }}} # ans += rec(a, b + c + 1) # ans += rec(b, c + a + 1) # ans += rec(c, a + b + 1) # p ans % MOD end