#include<bits/stdc++.h>
using namespace std;
const int mod=1e9+7;
int n,m,u,v;
const int MaxM=1e6+50;
long long qpow(long long x,int y){
	long long z=1;
	while(y>0){
		if(y%2){
			y--;
			z=(z*x)%mod;
		}else{
			y/=2;
			x=(x*x)%mod;
		}
	}
	return z%mod;
}
int main(){
	freopen("barrack.in","r",stdin);
	freopen("barrack.out","w",stdout);
	scanf("%d%d",&n,&m);
	for(int i=1;i<m+1;i++)
		scanf("%d%d",&u,&v);
	printf("%lld\n",(qpow(4,mod-2)*n%mod*(n-1)%mod+n)*qpow(2,n-1)%mod);
	return 0;
}