#include using namespace std; const int M = 2e6; const int P = 1e9 + 7; const int N = 2e6 + 50; int t, n, x, y, a, b, c, d; int f1, f2, inv[N], sum[N]; int read() { int x = 0, p = 1; char c = getchar(); for (; !isdigit(c); c = getchar()) if (c == '-') p = -1; for (; isdigit(c); c = getchar()) x = (x << 3) + (x << 1) + (c & 15); return x * p; } int write(int x) { if (x >= 10) write(x / 10); putchar(x % 10 + '0'); } int writeln(int x) { write(x); putchar('\n'); } int main() { sum[1] = inv[1] = 1; for (int i = 2; i <= M; i++) { inv[i] = 1LL * (P - P / i) * inv[P % i] % P; sum[i] = (sum[i - 1] + inv[i]) % P; } t = read(); while (t--) { n = read(); x = read(); y = read(); if (x == y) { puts("0"); continue; } if (y == 1 || y == n) { writeln(sum[abs(x - y)]); continue; } a = 1LL * (n - y) * inv[n - y + 1] % P; b = ((1LL * (sum[n] - sum[y] + P) * n % P - (n - y) + P) * inv[n - y + 1] % P + 1) % P; c = 1LL * (y - 1) * inv[y] % P; d = (((1LL * sum[n] - sum[n - y + 1] + P) * n % P - (y - 1) + P) * inv[y] % P + 1) % P; f1 = (1LL * a * d + b) % P * (n - y + 1) % P * y % P * inv[n] % P; f2 = (1LL * c * f1 + d) % P; if (x < y) { f1 = (1LL * f1 + sum[n - x] - sum[n - y + 1] + P) % P; writeln(f1); } else { f2 = (1LL * f2 + sum[x - 1] - sum[y] + P) % P; writeln(f2); } } return 0; }