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

const int mod = 1e9 + 7;
const int N = 5e5 + 7;
int n, m;
long long f[N][2];

long long qp(int x, int y) {
	long long ans = 1, base = x;
	while(y) {
		if(y & 1)
			ans = ans * base % mod;
		base = base * base % mod, y >>= 1;
	}
	return ans;
}

int main() {
	freopen("barrack.in", "r", stdin);
	freopen("barrack.out", "w", stdout);
	ios::sync_with_stdio(0);
	cin.tie(0);
	cin >> n >> m;
	for(int i = 1, u, v; i <= m; ++i)	
		cin >> u >> v;
	f[1][0] = f[1][1] = 1;
	for(int i = 2; i <= n; ++i)
		f[i][0] = (f[i - 1][0] + f[i - 1][1]) * 2 % mod, f[i][1] = f[i - 1][0] * 2 + f[i - 1][1];
	cout << ((f[n][0] + f[n][1]) % mod - qp(2, n - 1) + mod) % mod;
	return 0;
}