#include<bits/stdc++.h>
using namespace std;
int n,m;
inline int read()
{int s=0,w=1;
char c=getchar();
for(;!isdigit(c);c=getchar()) if(c=='-') w=-1;
for(;isdigit(c);c=getchar()) s=(s<<3)+(s<<1)+(c^48);
return s*w;}
int main()
{
freopen("barrack.in","r",stdin);
freopen("barrack.out","w",stdout);
n=read(),m=read();
int sum=1,a[100000],b[100000];
for(int i=1;i<=m;i++) a[i]=read(),b[i]=read();
for(int i=1;i<=n;i++) sum=(sum*2)%1000000007;
sum=sum+6;
printf("%d",sum);
return 0;
}