#include using namespace std; const int mod = 1000000007; int T, n, x, y; int h[2000010], inv[2000010]; int suma, sumb; inline int power(int a, int b) { long long res = a, ans = 1; for (; b; b >>= 1, res = res * res % mod) if (b & 1) ans = ans * res % mod; return ans; } inline int calc(int a, int b, int c, int d) { return (1ll * a * d + 1ll * (mod - b) * c) % mod; } int main() { for (int i = 1; i <= 2000000; i++) inv[i] = i == 1 ? 1 : 1ll * (mod - mod / i) * inv[mod % i] % mod, h[i] = (h[i - 1] + inv[i]) % mod; scanf("%d", &T); while (T--) { scanf("%d%d%d", &n, &x, &y); if (x == y) { puts("0"); continue; } int a1 = 1ll * inv[n] * y % mod, b1 = 1ll * inv[n] * (n - y + 1) % mod, c1 = (h[n] - h[y] + mod) % mod; int a2 = a1, b2 = b1, c2 = (h[n] - h[n - y + 1] + mod) % mod; a1--, b2--; int ans; if (x > y) { ans = 1ll * calc(c1, b1, c2, b2) * power(calc(a1, b1, a2, b2), mod - 2) % mod; ans++; ans = (0ll + ans + h[x - 1] - h[y] + mod) % mod; } else { ans = 1ll * calc(a1, c1, a2, c2) * power(calc(a1, b1, a2, b2), mod - 2) % mod; ans++; ans = (0ll + ans + h[n - x] - h[n - y + 1] + mod) % mod; } printf("%d\n", ans); } }