#include<bits/stdc++.h>
using namespace std;
#define ll long long
int read(){
	int x=0,f=1;
	char c=getchar();
	while(c<'0'||c>'9'){
		if(c=='-') f=-1;
		c=getchar();
	}
	while('0'<=c&&c<='9'){
		x=(x<<3)+(x<<1)+c-'0';
		c=getchar();
	}
	return x*f;
}
const int N=5e5+10,M=1e6+10,mod=1e9+7;
int n,m;
int cnt=0,head[N];
struct edge{
	int to,next;
}e[2*M];
ll ans;
ll Pow(int t){
	ll base=2,res=1;
	while(t>0){
		if(t&1){
			t--;
			res=(res*base)%mod;
		}
		t>>=1;
		base=(base*base)%mod;
	}
	return res;
}
void putin(){
	n=read();m=read();
	for(int i=1;i<=m;i++){
		int u=read(),v=read();
		e[++cnt].to=v;
		e[cnt].next=head[u];
		head[u]=cnt;
	}
}
namespace Sub1{
	void mian(){
		for(int i=1;i<=n;i++){
			for(int j=i;j<=n;j++){
				ans=(ans+Pow(n-j+i-1))%mod;
			}
		}
		printf("%lld\n",ans);
	}
}
int main()
{
	freopen("barrack.in","r",stdin);
	freopen("barrack.out","w",stdout);
	putin();
	Sub1 :: mian();
	return 0;
}
