Problem: Given an undirected connected graph with vertices and edges. The graph contains no loops (edges from a vertex to itself) and multiple edges (i.e. no more than one edge between each pair of vertices). The vertices of the graph are numbered from to .
Find the number of paths from a vertex to whose length differs from the shortest path from to by no more than . It is necessary to consider all suitable paths, even if they pass through the same vertex or edge more than once (i.e. they are not simple).
Graph consisting of of vertices and of edges
For example, let , , and , and let the graph look like the figure above. Then the length of the shortest path from to is . Consider all paths whose length is at most .
- . The length of the path is .
- . Path length is .
- . Path length is .
- . Path length is .
There is a total of of matching paths.
Input Format: The first line of test contains the number () —the number of test cases in the test.
Before each test case, there is a blank line.
The first line of test case contains two numbers (, ) —the number of vertices and edges in the graph.
The second line contains two numbers and (, ) —the numbers of the start and end vertices of the path.
The following lines contain descriptions of edges: the th line contains two integers , () — the numbers of vertices that connect the th edge. It is guaranteed that the graph is connected and does not contain loops and multiple edges.
It is guaranteed that the sum of values on all test cases of input data does not exceed . Similarly, it is guaranteed that the sum of values on all test cases of input data does not exceed .
Output Format: For each test case, output a single number — the number of paths from to such that their length differs from the length of the shortest path by no more than .
Since this number may be too large, output it modulo .