// atcoder/hhkb2020/D/main.cpp
// author: @___Johniel
// github: https://github.com/johniel/

#include <bits/stdc++.h>

#define each(i, c) for (auto& i : c)
#define unless(cond) if (!(cond))

using namespace std;

template<typename P, typename Q> ostream& operator << (ostream& os, pair<P, Q> p) { os << "(" << p.first << "," << p.second << ")"; return os; }
template<typename P, typename Q> istream& operator >> (istream& is, pair<P, Q>& p) { is >> p.first >> p.second; return is; }
template<typename T> ostream& operator << (ostream& os, vector<T> v) { os << "("; for (auto& i: v) os << i << ","; os << ")"; return os; }
template<typename T> istream& operator >> (istream& is, vector<T>& v) { for (auto& i: v) is >> i; return is; }
template<typename T> ostream& operator << (ostream& os, set<T> s) { os << "#{"; for (auto& i: s) os << i << ","; os << "}"; return os; }
template<typename K, typename V> ostream& operator << (ostream& os, map<K, V> m) { os << "{"; for (auto& i: m) os << i << ","; os << "}"; return os; }

template<typename T> inline T setmax(T& a, T b) { return a = std::max(a, b); }
template<typename T> inline T setmin(T& a, T b) { return a = std::min(a, b); }

using lli = long long int;
using ull = unsigned long long;
using point = complex<double>;
using str = string;
template<typename T> using vec = vector<T>;

constexpr array<int, 8> di({0, 1, -1, 0, 1, -1, 1, -1});
constexpr array<int, 8> dj({1, 0, 0, -1, 1, -1, -1, 1});
constexpr lli mod = 1e9 + 7;

// from: https://qiita.com/drken/items/3b4fdf0a78e7a138cd9a
template<int MOD> struct Fp {
  long long val;
  constexpr Fp(long long v = 0) noexcept : val(v % MOD) {
    if (val < 0) val += MOD;
  }
  constexpr int getmod() { return MOD; }
  constexpr Fp operator - () const noexcept {
    return val ? MOD - val : 0;
  }
  constexpr Fp operator + (const Fp& r) const noexcept { return Fp(*this) += r; }
  constexpr Fp operator - (const Fp& r) const noexcept { return Fp(*this) -= r; }
  constexpr Fp operator * (const Fp& r) const noexcept { return Fp(*this) *= r; }
  constexpr Fp operator / (const Fp& r) const noexcept { return Fp(*this) /= r; }
  constexpr Fp& operator += (const Fp& r) noexcept {
    val += r.val;
    if (val >= MOD) val -= MOD;
    return *this;
  }
  constexpr Fp& operator -= (const Fp& r) noexcept {
    val -= r.val;
    if (val < 0) val += MOD;
    return *this;
  }
  constexpr Fp& operator *= (const Fp& r) noexcept {
    val = val * r.val % MOD;
    return *this;
  }
  constexpr Fp& operator /= (const Fp& r) noexcept {
    long long a = r.val, b = MOD, u = 1, v = 0;
    while (b) {
      long long t = a / b;
      a -= t * b; swap(a, b);
      u -= t * v; swap(u, v);
    }
    val = val * u % MOD;
    if (val < 0) val += MOD;
    return *this;
  }
  constexpr bool operator == (const Fp& r) const noexcept {
    return this->val == r.val;
  }
  constexpr bool operator != (const Fp& r) const noexcept {
    return this->val != r.val;
  }
  friend constexpr ostream& operator << (ostream &os, const Fp<MOD>& x) noexcept {
    return os << x.val;
  }
  friend constexpr Fp<MOD> modpow(const Fp<MOD> &a, long long n) noexcept {
    if (n == 0) return 1;
    auto t = modpow(a, n / 2);
    t = t * t;
    if (n & 1) t = t * a;
    return t;
  }
};
// constexpr lli mod = 1e9 + 7;
using mint = Fp<mod>;

int main(int argc, char *argv[])
{
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.setf(ios_base::fixed);
  cout.precision(15);

  int _;
  cin >> _;

  lli _n, _a, _b;
  while (cin >> _n >> _a >> _b) {
    if (_n - _a - _b < 0) {
      cout << 0 << endl;
      continue;
    }

    mint n(_n);
    mint a(_a);
    mint b(_b);

    mint x = (n - a + 1) * (n - b + 1);
    mint y = n - a - b + 1;
    mint z = (y + 1) * y / 2;

    cout << (x * z * 4) - (z * z * 4) << endl;
  }

  return 0;
}

#include <iostream>
#include <string>
#include <iomanip>
#include <sstream>
#include <istream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <climits>

using namespace std;

int max(int, int);
int min(int, int);
int positiveNum(int);
unsigned long long factorial(int);
unsigned long long combination(int, int);
long long power(int, int);
bool between(int, int, int);
vector<string> split(string, char);
int digit_sum(int);
vector<long long> divisors(long long);
//cout << fixed << setprecision(15) << y << endl;


int main()
{
  long long n;
  cin >> n;
  
  vector<long long> div = divisors(n*2);
  
  long long count = 0;
  for(long long i = 0; div[i] * div[i] <= n*2; i++)
  {
      if((n*2/div[i] - div[i]) % 2 == 1)
      {
        count++;
      }
  }
  
  cout << count*2 << endl;
  
  return 0;
}
      
//2つの整数のうち大きい方を返す
int max(int a, int b)
{
  if(a > b)
  {
    return a;
  }
  else
  {
    return b;
  }
}
   
//2つの整数のうち小さい方を返す
int min(int a, int b)
{
  if(a < b)
  {
    return a;
  }
  else
  {
    return b;
  }
}

//入力が正ならその値，負なら0を返す
int positiveNum(int x)
{
  if(x >= 0)
  {
    return x;
  }
  else
  {
    return 0;
  }
}

//階乗
unsigned long long factorial(int n)
{
  unsigned long long ans = 1;
  
  for(int i = 1; i <= n; i++)
  {
    ans *= i;
  }
  
  return ans;
}

//mの中からn取る組み合わせの数
unsigned long long combination(int m, int n)
{
  if(m == n)
  {
    return 1;
  }
  else if(n == 0)
  {
    return 1;
  }
  else
  {
    return combination(m-1, n-1) + combination(m-1, n);
  }
   
}

//cがaとbの間にあるか
bool between(int a, int b, int c)
{
  if(a > b)
  {
    int swap;
    swap = a;
    a = b;
    b = swap;
  }
  if(a <= c && c <= b)
  {
    return true;
  }
  else
  {
    return false;
  }
}

//累乗(long long版)
long long power(int x, int y)
{
  long long num = 1;
  
  for(int i = 0; i < y; i++)
  {
    num *= x;
  }
  
  return num;
}

//カンマ等で区切られた文字列を要素で分ける
vector<string> split(string s, char c)
{
  vector<string> v;

  stringstream ss{s};
  string buf;

  while(getline(ss, buf, c))
  {
    v.push_back(buf);
  }

  return v;

}

//各桁の和を求める
int digit_sum(int x)
{
  int sum = 0;
  
  while(x > 0)
  {
    sum += x % 10;
    x /= 10;
  }
  
  return sum;
}
  
//Nの約数を求める
vector<long long> divisors(long long N)
{
  vector<long long> a;
  
  for (long long i = 1; i * i <= N; i++)
  {
    if (N % i == 0)
    {
      a.push_back(i);
      if (N/i != i) 
      {
        a.push_back(N/i);
      }
    }
  }
  
  sort(a.begin(), a.end());
  
  return a;
}