#include <bits/stdc++.h>
#define FOR(x,l,r) for(int x = l; x <= r; ++x)
#define _FOR(x,l,r) for(int x = r; x >= l; --x)
#define pb emplace_back
using namespace std;
const int N = 5e5 + 5, MOD = 1e9 + 7;
int n, m, ans;
vector<int> G[N];
int qpow(int a, int b, int p)
{
	int r = 1;
	while (b)
	{
		if (b & 1) r = (1ll * r * a) % MOD;
		a = (1ll * a * a) % MOD;
		b >>= 1;
	}
	return r;
}
int main()
{
	freopen("barrack.in", "r", stdin);
	freopen("barrack.out", "w", stdout);
	ios::sync_with_stdio(0);
	cin >> n >> m;
	FOR(i, 1, m)
	{
		int u, v;
		cin >> u >> v;
		G[u].pb(v);
		G[v].pb(u);
		// tarjan();
	}
	FOR(i, 1, n)
	{
		FOR(j, i, n)
		{
			if (i == j)
			{
				ans += qpow(2, m, MOD);
				ans %= MOD;
				continue;
			}
			ans += (1ll * qpow(2, j - i - 1, MOD) * qpow(2, n - j + i - 1, MOD)) % MOD;
			ans %= MOD;
		}
	}
	cout << ans << endl;
	return 0;
}