cho.sh
Notes
Loading...

Cycle with Two Leaves

Time limit

4s

Memory limit

1024 MB

Problem

You are given an undirected simple graph GGG. Count the number of subgraphs with the following shape.

  • Four distinct vertices form one 4-cycle.
  • Two other distinct vertices are attached as leaves to the same vertex of that 4-cycle.

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+710^9+7109+7.

Input

The first line contains the number of vertices NNN and the number of edges MMM of GGG. (1≤N,M≤239000)(1 \le N, M \le 239000)(1≤N,M≤239000)

Each of the next MMM lines contains two vertex numbers xxx and yyy joined by an edge. (1≤x,y≤N)(1 \le x, y \le N)(1≤x,y≤N)

The graph is simple, and the vertices are numbered from 111 to NNN.

Output

Print the number of subgraphs satisfying the condition, modulo 109+710^9+7109+7.