- Time limit: 1.00 s
- Memory limit: 512 MB
Consider a directed graph that has nodes and edges. Your task is to count the number of paths from node to node with exactly edges.
Input
The first input line contains three integers , and : the number of nodes and edges, and the length of the path. The nodes are numbered .
Then, there are lines describing the edges. Each line contains two integers and : there is an edge from node to node .
Output
Print the number of paths modulo .
Constraints
Example
Input:
3 4 8 1 2 2 3 3 1 3 2
Output:
2
Explanation: The paths are and .