#pragma region Macros #include using namespace std; typedef long long ll; typedef unsigned long long ull; typedef pair pii; typedef pair pil; typedef pair pli; typedef pair pll; typedef pair, int> ppi; typedef vector vi; typedef vector vvi; typedef vector vl; typedef vector vvl; typedef bitset<60> Bitset; const ll INFL = 1LL << 60; const int INF = 1000000005; const int MOD = 1000000007; ll GCD(ll a, ll b) { return b ? GCD(b, a % b) : a; } ll LCM(ll a, ll b) { return (a * b) / GCD(a, b); } bool range(int x,int y,int X,int Y){if(0<=x&&x>n>>m; COMinit(); ll tot = (COM(2*n,n)*2*n); ll c = 0; for(int i = 0; i < m; i++) { int t,x,y;cin>>t>>x>>y; if(t==1) (c+=(COM(x+y,y)*COM(2*n-x-y-1,n-y))%MOD)%=MOD; else (c+=(COM(x+y,y)*COM(2*n-x-y-1,n-x))%MOD)%=MOD; } cout<<(tot-c+MOD)%MOD<