#Lutece1159. Easy problem ( trust me

Easy problem ( trust me

Migrated from Lutece 1159 Easy problem ( trust me

All parts of this problem, including description, images, samples, data and checker, might be broken. If you find bugs in this problem, please contact the admins.

Description

Given a Directed acyclic graph (DAG) with NN (1N201 \leq N \leq 20) nodes and MM edges.

There is a set SS which contains KK (1K1091 \leq K \leq 10^9) distinct integers. Each node has a set that contains some distinct integers (possibly empty).

The Directed acyclic graph is legal only if the set of each node is a subset of SS and is a subset of nodes which can directly arrive it.

You are supposed to calculate how many kinds of graphs are legal. Calculate the answer mod 109+710^9+7.

Two graphs are considered different if there is at least one node in two graphs has different set.

See Hint for more understanding.

Input

The first line contains three integers NN (1N201 \leq N \leq 20) and MM, KK (1K1091 \leq K \leq 10^9).

The second MM lines contains two integers aa and bb (1a,bN1 \leq a , b \leq N), representing that there is a direct edge from aa to bb

It is guaranteed that the given graph is a simple graph without multiple edges.

Output

Output the answer mod 109+710^9+7.

Samples

4 4 2
1 2
2 3
1 3
3 4
25

Note

Let consider the following sample.

There are 2 nodes and 1 edges that is 1--->2. And KK=2, that means SS contains 2 integers.

the set of node 2 must be a subset of node 1.

the set of node1 must be a subset of node SS

if S={1, 2}, then , let S1 be the set of node 1, S2 be the set of node2

S1={1 ,2} S2={1, 2}

S1={1 ,2} S2={ 1 }

S1={1 ,2} S2={ 2 }

S1={1 ,2} S2={ }

S1={ 1 } S2={ 1 }

S1={ 1 } S2={ }

S1={ 2 } S2={ 2 }

S1={ 2 } S2={ 0 }

S1={ } S2={ }

Therefore ,the answer is 9. There are 9 legal DAGs.

Resources

2015 UESTC ACM Summer Training Team Selection (4)