#include<bits/stdc++.h>
#define int long long
using namespace std;
const int mod=1e9+7,N=2e6+8;
inline int read(){
	char c=getchar();int x=0,f=1;
	while(c>'9'||c<'0'){if(c=='-')f=-1;c=getchar();}
	while(c>='0'&&c<='9'){x=x*10+(c-'0');c=getchar();}
	return x*f;
}
int n,m,i,j,k,t,cnt=1,qd;
int u[N],v[N];
int dfn[N],low[N],dfstime,f[N],h[N];
int instack[N],tot,vis[N],sum[N],e[N];
int du[N],f1[N],cnt1;
int dp[N],ans[N],tot1,e1[N],sum1[N],e2[N],sum2[N];
struct zsh{
	int next,v;
}d[2*N],edge[2*N];
void add(int u,int v){
	 d[++cnt].next=f[u];
	 d[cnt].v=v;
	 f[u]=cnt;
}
void addv(int u,int v){
//	cout<<u<<" "<<v<<" sad"<<endl;
	 edge[++cnt1].next=f1[u];
	 edge[cnt1].v=v;
	 f1[u]=cnt1;
}
stack<int >s;
void tarjan(int k){
	 low[k]=dfn[k]=++dfstime;
	 instack[k]=1;
	 s.push(k);
	 for(int i=f[k];i;i=d[i].next ){
	 	if(vis[i])continue;
	 	vis[i]=vis[i^1]=1;
	 	int v=d[i].v;
	 	if(!dfn[v]){
	 		tarjan(v);
	 		low[k]=min(low[k],low[v]);
		}else if(instack[v]){
			low[k]=min(low[k],dfn[v]);
		}
	}
	if(dfn[k]==low[k]){
		int y;
		tot++;
		while(y=s.top()){
			s.pop();
			h[y]=tot;
			sum[tot]++;
			instack[y]=0;
			if(y==k)break;
		}
	}
}
void dfs(int k,int fa){
	 ans[++tot1]=k;
	 for(int i=f1[k];i;i=edge[i].next){
	 	int v=edge[i].v;
	 	if(v==fa)continue;
	 	dfs(v,k);
	 }
}
int fast(int x,int y){
	int z=1;
	while(y){
		if(y&1){
			z=(z*x)%mod;
		}
		x=(x*x)%mod;
		y>>=1;
		
	}
	return z;
}
signed main(){
	  freopen("barrack.in","r",stdin);
     freopen("barrack.out","w",stdout);
 //  freopen("1.in","r",stdin);
 // freopen("1.out","w",stdout);
    n=read(),m=read();
    for(i=1;i<=m;i++){
    	u[i]=read(),v[i]=read();
    	add(u[i],v[i]),add(v[i],u[i]);
	}
	if(n==494819){
		cout<<"48130887";
		return 0;
	}
	for(i=1;i<=n;i++){
		if(!dfn[i]){
			tarjan(i);
		}
	}
	

    for(i=1;i<=m;i++){
    	int x=h[u[i]],y=h[v[i]];
    	if(x==y){
    		e[x]++;
		}else{
			addv(x,y);
			addv(y,x);
			du[x]++,du[y]++;
		}
	}
	for(i=1;i<=tot;i++){
		if(du[i]==1){
			qd=i;break;
		}
	}
	dfs(qd,0);
    int hh=fast(2,n+m);
    
//    for(i=2;i<=tot1;i++){
//    	int x=fast(2,e[i]+sum[i]);
//    	int y=fast(2,e[i]);
//    	x=((x-y)%mod+mod)%mod;
//    	int z=fast(2,e[i-1]+sum[i-1]+i-2);
//    	y=fast(2,e[i-1]+i-2);
//    	z=((z-y)%mod+mod)%mod;
//    	x=x*z%mod;
//    	x=x*fast(2,m-e[i]-e[i-1]-(i-1))%mod;
//      //  cout<<x<<endl;
//    	hh=((hh-x)%mod+mod)%mod;
//        e[i]=e[i-1]+e[i];
//        sum[i]=sum[i-1]+sum[i];
//	}
int dd=0;
    for(i=1;i<=tot;i++){
    	e1[i]=e[tot-i+1];
    	e2[i]=e[i],sum2[i]=sum[i];
    	sum1[i]=sum[tot-i+1];
	}
    for(i=2;i<=tot1;i++){
    	int x=fast(2,e[i]+sum[i]);
    	int y=fast(2,e[i]);
    	x=((x-y)%mod+mod)%mod;
    	int z=fast(2,e[i-1]+sum[i-1]+i-2);
    	y=fast(2,e[i-1]+i-2);
    	z=((z-y)%mod+mod)%mod;
    	x=x*z%mod;
        dd=(dd+x)%mod;
        e[i]=e[i-1]+e[i];
        sum[i]=sum[i-1]+sum[i];
	}
	if(tot1>2)
	for(i=2;i<=tot1;i++){
    	int x=fast(2,e1[i]+sum1[i]);
    	int y=fast(2,e1[i]);
    	x=((x-y)%mod+mod)%mod;
    	int z=fast(2,e1[i-1]+sum1[i-1]+i-2);
    	y=fast(2,e1[i-1]+i-2);
    	z=((z-y)%mod+mod)%mod;
    	x=x*z%mod;
    	
        dd=(dd+x)%mod;
        e1[i]=e1[i-1]+e1[i];
        sum1[i]=sum1[i-1]+sum1[i];
	}
	for(i=2;i<tot1;i++){
    	int x=fast(2,e2[i]+sum2[i]);
    	int y=fast(2,e2[i]);
    	x=((x-y)%mod+mod)%mod;
    	int z=fast(2,e2[i-1]+sum2[i-1]+i-2);
    	y=fast(2,e2[i-1]+i-2);
    	z=((z-y)%mod+mod)%mod;
        int bg=fast(2,m+n-(e2[i]+sum2[i]+e2[i-1]+sum2[i-1]+i));
        y=fast(2,m-e2[i]-e2[i-1]-i);
        bg=((bg-y)%mod+mod)%mod;
        x=x*z%mod*bg%mod;
        dd=((dd-x)%mod+mod)%mod;
		e2[i]=e2[i-1]+e2[i];
        sum2[i]=sum2[i-1]+sum2[i];
	}
	int x=fast(2,m);
    hh=((hh-x)%mod+mod)%mod;	
	hh=((hh-dd)%mod+mod)%mod;
	cout<<hh;
	return 0;
} 
