#include<bits/stdc++.h>
#define ll long long
#define IN inline
#define rg register
#define re(i,a,b) for(rg int i=a,i##up=b;i<=i##up;i++)
#define er(i,a,b) for(rg int i=a,i##dw=b;i>=i##dw;i--)
#define go(i,x) for(rg int i=head[x];i;i=nxt[i])
#define mem(a,x) memset(a,x,sizeof a)
using namespace std;
const int N=5e5+5,M=1e6+5,ljc=1e9+7;
IN ll read(){
	rg ll res=0,f=1; rg char c; do f&=((c=getchar())!='-'); while(c<'0' || '9'<c);
	for(;'0'<=c && c<='9';res=res*10+(c^48),c=getchar()); return f?res:-res;
}
IN int tomin(int &a,int b){return a>b?a=b,1:0;}
int tot=1,head[N],nxt[M<<1],ver[M<<1];
IN void add(int x,int y){ver[++tot]=y,nxt[tot]=head[x],head[x]=tot;}
int n,m;
int dfn[N],cur,low[N],brg[N];
void tarjan(int x,int fa){
	dfn[x]=low[x]=++cur; int y;
	go(i,x) if((y=ver[i])^fa){
		if(!dfn[y]){
			tarjan(y,x),tomin(low[x],low[y]);
			if(dfn[x]<low[y]) brg[i]=brg[i^1]=1;
		}else tomin(low[x],dfn[y]);
	}
}
int cnt,col[N];
vector<int> dcc[N];
void fdcc(int x,int fa){
	col[x]=cnt,dcc[cnt].push_back(x);
	int y; go(i,x) if((y=ver[i])^fa && !brg[i] && !col[y]) fdcc(y,x);
}
namespace T{
	int tot,head[N],nxt[N<<1],ver[N<<1];
	IN void add(int x,int y){ver[++tot]=y,nxt[tot]=head[x],head[x]=tot;}
	int n,a[N],b[N],sz[N],e[N];
	ll pw[N<<1],dp[N][2];
	IN void init(){
		re(i,pw[0]=1,(N-5)<<1) pw[i]=(pw[i-1]<<1)%ljc;
	}
	IN void debug(){
		re(i,1,n) printf("# %d: %d %d\n",i,a[i],b[i]);
	}
	IN void dfs1(int x,int fa){
//		printf("# %d %d\n",x,fa);
		sz[x]=1,e[x]=b[x];
		int y; go(i,x) if((y=ver[i])^fa){dfs1(y,x),sz[x]+=sz[y],e[x]+=e[y];}
		e[x]+=sz[x]-1;
	}
	IN void dfs2(int x,int fa){
		dp[x][0]=pw[e[x]];
		if(sz[x]==1){
			dp[x][1]=(pw[a[x]]-1)*pw[b[x]]%ljc;
			return;
		}
		int y; ll res1=1,res2=1;
		go(i,x) if((y=ver[i])^fa){
			dfs2(y,x),res1=res1*(2*dp[y][0]%ljc+dp[y][1])%ljc,res2=res2*2*dp[y][0]%ljc;
		}
		dp[x][1]=(pw[a[x]+b[x]]*res1%ljc-pw[b[x]]*res2%ljc+ljc)%ljc;
	}
	IN void sol(){
		init();
		dfs1(1,0);
		dfs2(1,0);
//		re(i,1,n) printf("%d: %d %d %lld %lld\n",i,e[i],sz[i],dp[i][0],dp[i][1]);
		printf("%lld\n",dp[1][1]);
	}
}
IN void init(){
	T::n=cnt; int y;
	re(x,1,n) go(i,x) if(col[x]^col[y=ver[i]]) T::add(col[x],col[y]);
	re(i,1,cnt) T::a[i]=dcc[i].size();
	for(int i=2;i<=tot;i+=2) if(!brg[i]) T::b[col[ver[i]]]++;
}
int main(){
	freopen("barrack.in","r",stdin),freopen("barrack.out","w",stdout);
	re(i,1,(n=read(),m=read())){int u=read(),v=read(); add(u,v),add(v,u);}
	tarjan(1,0);
	re(i,1,n) if(!col[i]) ++cnt,fdcc(i,0); init();
	T::sol();
//	re(i,1,n) printf("%d: %d %d\n",i,dfn[i],low[i]);
//	for(rg int i=2;i<=tot;i+=2) if(brg[i]) printf("(%d,%d)\n",ver[i],ver[i^1]);
//	re(i,1,cnt){for(auto x:dcc[i]) printf("%d ",x); puts("");}
//	T::debug();
	return 0;
}
/*
7 8
1 2
2 3
3 1
4 5
5 6
6 4
2 4
3 7
*/