#include<bits/stdc++.h>
using namespace std;
int n,m;
struct tu{
	int to,next,vis;	
}tr[2000010];
long long ans=0;
int head[2000010],cnt;
void add(int u,int v){
	tr[++cnt].to=v;
	tr[cnt].next=head[u];
	head[u]=cnt;
}
void dfs(int x){
	for(int i=head[x];i;i=tr[i].next){
		int xx=tr[i].to;
		if(xx<x)ans+=9;
		else {
			ans+=15;
			dfs(xx);
		}
		
	}
}
int main(){
	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;
		add(u,v);
		add(v,u);
	}
	if(m==n-1){
		ans=n*(2*n-1)-n+1;
		ans=(ans+1000000007)%1000000007;
		cout<<ans<<endl;
	}
	else{
		for(int i=1;i<=n;i++)dfs(i);
		cout<<(ans+1+1000000007)%1000000007<<endl;
	}
	fclose(stdin);
	fclose(stdout);
	return 0;
}
