#include <bits/stdc++.h>
using namespace std;

typedef long long ll;

const int N = 1e6 + 5, mod = 1e9 + 7;

int n, m, dfn[N], low[N], in[N], sta[N], top, pw[N], fa[N], tim;
int tot, cnt[N], bel[N], f[N][2][2];
vector<int> g[N], G[N];

int ans = 1;

void tarjan(int u, int f) {
	dfn[u] = low[u] = ++tim;
	in[sta[++top] = u] = 1;
	for (auto v : g[u]) if (v != f) {
		if (!dfn[v]) {
			tarjan(v, u);
			low[u] = min(low[u], low[v]);
		} else if (in[v]) {
			low[u] = min(low[u], dfn[v]);
		}
	}
	if (dfn[u] == low[u]) {
		++tot;
		while (1) {
			bel[sta[top]] = tot;
			in[sta[top]] = 0;
			if (sta[top--] == u) break;
		}
	}
}

void dfs(int u) {
	f[u][0][0] = f[u][0][1] = 1;
	f[u][1][0] = f[u][1][1] = pw[cnt[u]] - 1;
	for (auto v : G[u]) if (v != fa[u]) {
		fa[v] = u, dfs(v);
		int res[2][2] = {0, 0};
		for (int i = 0; i < 2; i++) {
			for (int j = 0; j < 2; j++) {
				for (int k = 0; k < 2; k++) {
					res[i | k][j] = (res[i | k][j] + (ll)f[u][i][j] * f[v][k][i | j] % mod * ((k & (i | j)) ? 1 : 2)) % mod;
				}
			}
		}
		for (int i = 0; i < 2; i++) {
			for (int j = 0; j < 2; j++) f[u][i][j] = res[i][j];
		}
	}
}

int main() {
	freopen("barrack.in", "r", stdin);
	freopen("barrack.out", "w", stdout);
	scanf("%d%d", &n, &m);
	for (int i = 1; i <= m; i++) {
		int u, v;
		scanf("%d%d", &u, &v);
		g[u].emplace_back(v);
		g[v].emplace_back(u);
	}
	tarjan(1, 0);
	for (int i = 1; i <= n; i++) {
		++cnt[bel[i]];
		for (auto v : g[i]) if (v > i) {
			if (bel[i] != bel[v]) {
				G[bel[i]].emplace_back(bel[v]);
				G[bel[v]].emplace_back(bel[i]);
			} else {
				ans = (ll)2 * ans % mod;
			}
		}
	}
	pw[0] = 1;
	for (int i = 1; i <= m; i++) {
		pw[i] = (ll)2 * pw[i - 1] % mod;
	}
	int rt = 0;
	for (int i = 1; i <= tot; i++)
		if (G[i].size() == 1) rt = i;
	dfs(rt);
	ans = (ll)ans * f[rt][1][0] % mod;
	printf("%d\n", ans);
	return 0;
}