#include<bits/stdc++.h>
using namespace std;
#define ll long long
const ll mod = 1e9+7;
const int N = 5e5+10;
const int M = 1e6+10;
ll n,m;
ll sum1,sum2;
struct road{
	int u,v;
}mp[M];
int main(){
	freopen("barrack.in","r",stdin);
	freopen("barrack.out","w",stdout);
	scanf("%lld%lld",&n,&m);
	for(int i=0;i<m;i++)
		scanf("%d%d",&mp[i].u,&mp[i].v);
	ll x;
	for(ll i=1;i<=n;i++){
		x=1;
		for(ll j=n-i+1;j<=n;j++){
			x*=j;
			x%=mod;
		}
		sum1+=x;
		sum1%=mod;
	}
	sum2=1;
	for(ll i=1;i<=m;i++){
		x=1;
		for(ll j=n-i+1;j<=m;j++){
			x*=j;
			x%=mod;
		}
		sum2+=x;
	}
	printf("%lld",(sum1*sum2)%mod);
	fclose(stdin);
	fclose(stdout);
	return 0;
}
