Problem: There is a directed graph G with N vertices and M edges. The vertices are numbered 1 through N, and the edges are numbered 1 through M. Edge i is directed from x_i to y_i. Here, x_i < y_i holds. Also, there are no multiple edges in G.

Consider selecting a subset of the set of the M edges in G, and removing these edges from G to obtain another graph G'. There are 2^M different possible graphs as G'.

Alice and Bob play against each other in the following game played on G'. First, place two pieces on vertices 1 and 2, one on each. Then, starting from Alice, Alice and Bob alternately perform the following operation:

* Select an edge i such that there is a piece placed on vertex x_i, and move the piece to vertex y_i (if there are two pieces on vertex x_i, only move one). The two pieces are allowed to be placed on the same vertex.



The player loses when he/she becomes unable to perform the operation. We assume that both players play optimally.

Among the 2^M different possible graphs as G', how many lead to Alice's victory? Find the count modulo 10^9+7.

Constraints

* 2 ≤ N ≤ 15
* 1 ≤ M ≤ N(N-1)/2
* 1 ≤ x_i < y_i ≤ N
* All (x_i,\ y_i) are distinct.

Input

Input is given from Standard Input in the following format:


N M
x_1 y_1
x_2 y_2
:
x_M y_M


Output

Print the number of G' that lead to Alice's victory, modulo 10^9+7.

Examples

Input

2 1
1 2


Output

1


Input

3 3
1 2
1 3
2 3


Output

6


Input

4 2
1 3
2 4


Output

2


Input

5 10
2 4
3 4
2 5
2 3
1 2
3 5
1 3
1 5
4 5
1 4


Output

816

Solution (in CPP):

Solution:
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<queue>
#define fo(i,a,b) for(int i=a;i<=b;++i)
#define fd(i,b,a) for(int i=b;i>=a;--i)
#define efo(i,v,u) for(int i=BB[v],u=B[BB[v]][1];i;i=B[i][0],u=B[i][1])
#define max(x,y) ((x)>(y)?(x):(y))
#define min(x,y) ((x)<(y)?(x):(y))
#define mset(a,x) memset(a,x,sizeof(a))
using namespace std;
typedef long long ll;
char ch;
int read(){int n=0,p=1;for(ch=getchar();ch<'0' || ch>'9';ch=getchar())if(ch=='-') p=-1;for(;'0'<=ch && ch<='9';ch=getchar()) n=n*10+ch-'0';return n*p;}
const int N=17,M=32770,mo=1e9+7;
int n,m,_2[N],B0,BB[N],in[N],B[N*N][2],map[N][N];
void link(int u,int v){++in[v],map[u][v]=1,B[++B0][1]=v,B[B0][0]=BB[u],BB[u]=B0;}
ll f[M],h[N][M];
void upd(ll &x,ll y){x=(x+y)%mo;}
ll qmi(ll x,ll n)
{
	ll t=1;
	for(;n;n>>=1,x=x*x%mo) if(n&1) t=t*x%mo;
	return t;
}
int main()
{
	int x,y;
	n=read(),m=read();
	_2[0]=1;fo(i,1,n) _2[i]=_2[i-1]<<1;
	fo(i,1,m) x=read(),y=read(),link(x,y);
	fo(i,1,n)
		fo(s,0,_2[n]-1)
		{
			fo(j,1,n) if(s&_2[j-1]) upd(h[i][s],map[i][j]);
			h[i][s]=qmi(2,h[i][s]);
		}
	f[0]=1;
	fo(s,1,_2[n]-1) if(!(((s&1)>0)^((s&2)>0)))
	{
		for(int W=(s-1)&s;W>=0;W=(W-1)&s) if(!(((W&1)>0)^((W&2)>0)))
		{
			int L=s^W;
			ll t=1;
			fo(i,1,n) if(L&_2[i-1]) t=t*h[i][W]%mo;
			fo(i,1,n) if(W&_2[i-1]) t=t*(h[i][L]-1+mo)%mo;
			t=t*f[W]%mo;
			upd(f[s],t);
			if(!W) break;
		}
	}
	printf("%lld",(qmi(2,m)-f[_2[n]-1]+mo)%mo);
	return 0;
}