#abc284e. [abc284_e]Count Simple Paths
[abc284_e]Count Simple Paths
Problem Statement
You are given a simple undirected graph with vertices numbered to and edges numbered to . Edge connects vertex and vertex . The degree of each vertex is at most .
Let be the number of simple paths (paths without repeated vertices) starting from vertex . Print .
Constraints
- $0 \\leq M \\leq \\min \\left(2 \\times 10^5, \\frac{N(N-1)}{2}\\right)$
- The given graph is simple.
- The degree of each vertex in the given graph is at most .
- All values in the input are integers.
Input
The input is given from Standard Input in the following format:
Output
Print the answer.
Sample Input 1
4 2
1 2
2 3
Sample Output 1
3
We have the following three paths that count. (Note that a path of length also counts.)
- Vertex ;
- vertex , vertex ;
- vertex , vertex , vertex .
Sample Input 2
4 6
1 2
1 3
1 4
2 3
2 4
3 4
Sample Output 2
16
Sample Input 3
8 21
2 6
1 3
5 6
3 8
3 6
4 7
4 6
3 4
1 5
2 4
1 2
2 7
1 4
3 5
2 5
2 3
4 5
3 7
6 7
5 7
2 8
Sample Output 3
2023