#include using namespace std; typedef long long int ll; typedef pair P; typedef vector VI; typedef vector VVI; #define REP(i,n) for(ll i=0;i<(n);i++) #define ALL(v) v.begin(),v.end() constexpr ll MOD=1000000007; constexpr ll INF=2e18; const int MAX=510000; ll fac[MAX], finv[MAX], inv[MAX]; void COMinit(){ fac[0]=fac[1]=1; finv[0]=finv[1]=1; inv[1]=1; for (int i=2;i> t; while(t--){ ll h, w; cin >> h >> w; ll ans=0; cout << COM(h+w-3,h-1)*(h-1)*2%MOD << endl; } }