Time limit
4s
Memory limit
1024 MB
You are given an undirected simple graph G. Count the number of subgraphs with the following shape.
Equivalently, the target graph consists of one 4-cycle and two pendant edges incident to the same cycle vertex. Two subgraphs are considered different only when their selected edge sets are different. Extra edges in the original graph that are not selected do not matter. Print the answer modulo 109+7.
The first line contains the number of vertices N and the number of edges M of G. (1≤N,M≤239000)
Each of the next M lines contains two vertex numbers x and y joined by an edge. (1≤x,y≤N)
The graph is simple, and the vertices are numbered from 1 to N.
Print the number of subgraphs satisfying the condition, modulo 109+7.