#include<bits/stdc++.h>
#define Dtmyj trash
#define ll long long
#define db double
using namespace std;

const int mod=1e9+7;
int n,m,ansn=1,ansm=1,ans;

int jc(int x){
	for(int i=x-1;i>=1;i--){
		x=x*i%mod;
	}
	return x;
}

int main(){
    ios::sync_with_stdio(0);
    freopen("barrack.in","r",stdin);
    freopen("barrack.out","w",stdout);
	cin>>n>>m;
	for(int i=1;i<=m;i++){
		int u,v;
		cin>>u>>v;
	}
	if(n==1){
		cout<<1<<endl;
		return 0;
	}else if(m==1){
		for(int i=1;i<n;i++){
			ansn=(ansn+jc(n)/(jc(n-i)*jc(i)))%mod;
			cout<<jc(n)<<endl;
			cout<<jc(n-i)<<endl;
			cout<<jc(i)<<endl;
			cout<<(jc(n)/(jc(n-i)*jc(i)))<<endl;
		}
		cout<<ansn*2<<endl;
		return 0;
	}
	for(int i=1;i<n;i++){
		ansn=(ansn+jc(n)/(jc(n-i)*jc(i)))%mod;
	}
	for(int i=1;i<m;i++){
		ansm=(ansm+jc(m)/(jc(m-i)*jc(i)))%mod;
	}
	ans=(ll)ansm*ansn%mod;
	cout<<ans<<endl;
    return 0;
}

