#include<bits/stdc++.h>
using namespace std;
int n,m;
int main(){
	freopen("barrack.in","r",stdin);
	freopen("barrack.out","w",stdout);
	cin>>n>>m;
	for(int i=1;i<=m;i++){
		int qwq,egg;
		cin>>qwq>>egg;
	}
	long long int ans=1;
	for(int i=1;i<=n-3;i++){
		ans=ans*2%1000000007;
	}
	if(n==1){
		cout<<1;
		return 0;
	}
	if(n==2){
		cout<<5;
		return 0;
	}
	cout<<ans*n%1000000007*(n+3)%1000000007;
	return 0;
}