#include<bits/stdc++.h>
#define ll long long
#define inf (1<<30)
#define INF (1ll<<60)
#define pii pair<int,int>
#define fi first
#define se second
#define pb emplace_back
#define siz(a) (int)(a).size()
#define all(a) (a).begin(),(a).end()
#define rep(i,j,k) for(int i=(j);i<=(k);i++)
#define per(i,j,k) for(int i=(j);i>=(k);i--)
#define pt(a) cerr<<#a<<'='<<a<<' '
#define pts(a) cerr<<#a<<'='<<a<<'\n'
#define int long long
using namespace std;
const int MAXN=1e6+10;
const int MOD=1e9+7;
int ksm(int a,int p){
	int ret=1;while(p){
		if(p&1) ret=ret*a%MOD;
		a=a*a%MOD; p>>=1;
	}return ret;
}
vector<int> e[MAXN];
int dfn[MAXN],low[MAXN],stk[MAXN],top;
int bcc,col[MAXN],siz[MAXN],tot,in[MAXN];
void Tarjan(int x,int fa){
	dfn[x]=low[x]=++tot;stk[++top]=x;in[x]=1;
	for(int s:e[x]){
		if(s==fa) continue;
		if(!dfn[s]){
			Tarjan(s,x);
			low[x]=min(low[x],low[s]);
		}else if(in[s]) low[x]=min(low[x],dfn[s]);
	}
	if(dfn[x]==low[x]){
		bcc++;do{
			col[stk[top]]=bcc;
			siz[bcc]++;in[stk[top]]=0;
		}while(stk[top--]!=x);
	}
}
int u[MAXN],v[MAXN],Siz[MAXN],n;
int dp[MAXN][2][2],tmp[2][2];
void dfs(int x,int fa){
	dp[x][0][0]=dp[x][0][1]=1;
	dp[x][1][0]=dp[x][1][1]=(ksm(2,siz[x])+MOD-1)%MOD;
	for(int s:e[x]){
		if(s==fa) continue;
		dfs(s,x);
		rep(i,0,1) rep(j,0,1) tmp[i][j]=dp[x][i][j];
		dp[x][0][1]=tmp[0][1]*dp[s][0][1]%MOD*2%MOD;
		dp[x][0][0]=tmp[0][0]*dp[s][0][0]%MOD*2%MOD;
		dp[x][1][0]=(dp[s][1][1]*tmp[1][0]%MOD+
					dp[s][0][1]*tmp[1][0]%MOD*2%MOD+
					dp[s][1][0]*tmp[0][0]%MOD*2%MOD)%MOD;
		dp[x][1][1]=(dp[s][1][1]*(tmp[0][1]+tmp[1][1])%MOD+
					dp[s][0][1]*tmp[1][1]%MOD*2%MOD)%MOD;
	}
}
signed main()
{
	freopen("barrack.in","r",stdin);
	freopen("barrack.out","w",stdout);
	ios::sync_with_stdio(0);
	cin.tie(0);cout.tie(0);
	int m;cin>>n>>m;
	rep(i,1,m){
		cin>>u[i]>>v[i];
		e[u[i]].pb(v[i]);e[v[i]].pb(u[i]);
	}
	rep(i,1,n) if(!dfn[i]) Tarjan(i,i);
	rep(i,1,n) e[i].clear();
	int edge=1;
	rep(i,1,m){
		if(col[u[i]]==col[v[i]]){
			edge=edge*2%MOD;
			continue;
		}e[col[u[i]]].pb(col[v[i]]);
		e[col[v[i]]].pb(col[u[i]]);
	}
	dfs(1,0);
	cout<<edge*(dp[1][1][0])%MOD<<'\n';
	return 0;
}