#c22905. 路径数量统计
路径数量统计
Path Counting
Problem Description
You are given a directed graph (which may contain multiple edges and self-loops). Count the number of walks that start at vertex , use exactly edges, and end at vertex . Since the answer may be very large, output it modulo .
Input Format
The first line contains two integers , the number of vertices and edges, respectively.
The next lines each contain two integers , indicating a directed edge from to .
The last line contains three integers , the query.
Output Format
Output one line containing a single integer: the answer modulo .
Sample Input
2 3
1 2
2 1
1 1
1 2 3
Sample Output
2
Constraints
For of the test cases, , , , .