#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int mod =1e9+7;
const int MAXN = 5e5+5;
vector<int> e[MAXN];
ll ksm(int a,int x){
	ll ans=1;
	ll base=a;
	while(x){
		if(x&1) ans=(ans*base)%mod;
		base=(base*base)%mod;
		x>>=1;
	}
	return ans;
}
bool vis[3005];
int dis[3005][3005];
void bfs(int cur){
	vis[cur]=1;
	queue<int> q;
	q.push(cur);
	while(!q.empty()){
		int u=q.front();
		q.pop();
		int len=e[u].size();
		for(int i=0;i<len;i++){
			int v=e[u][i];
			if(vis[v]) continue;
			vis[v]=1;
			dis[cur][v]=dis[cur][u]+1;
			q.push(v);
		}
	}
}
int main()
{
	freopen("barrack.in","r",stdin);
	freopen("barrack.out","w",stdout);
	int n,m;
	scanf("%d%d",&n,&m);
	for(int i=0;i<m;i++){
		int u,v;
		scanf("%d%d",&u,&v);
		e[u].push_back(v);
		e[v].push_back(u);
	}
	ll ans=0;
	if(n<=3000){
		for(int i=1;i<=n;i++){
			bfs(i);
			for(int j=1;j<=n;j++) vis[j]=0;
		}
		ans=ksm(2,m)*n%mod;
		for(int i=1;i<=n;i++){
			for(int j=i+1;j<=n;j++){
				int dist=dis[i][j];
				int res=m-dis[i][j];
				ans+=ksm(2,res)%mod*ksm(2,dist-1)%mod;
				ans%=mod;
			}
		}
		cout<<ans;
		return 0;
	}else if(n<=500005){
		if(m==n-1){
			ans+=ksm(2,m)*n%mod;
			ll tmp=n*(n-1)/2%mod;
			ans=(ans+ksm(2,m-1)*tmp%mod)%mod;
			cout<<ans;
			return 0;
		}
	}
	return 0;
}

