Sum of Distances in Cactus

아직 제출이 없습니다시간 제한1초메모리 제한256 MB

문제

Find the sum of the distances between all pairs of vertices in a cactus graph. A cactus graph is a graph in which every edge belongs to at most one simple cycle. The distance between vertices is calculated as the number of edges in the shortest path connecting a given pair of vertices.

입력

First line contains two integers nn and mm --- the number of vertices and the number of edges in the cactus. 

Each of the following mm lines contains two integers u_iu\_i v_iv\_i --- the numeric labels of vertices connected by an edge. 

It is guaranteed that the graph is connected and does not have self-loops and multiple edges.

출력

Output a single line containing the sum of the distances between all pairs of vertices.

제한

  • 1n105 1 \le n \le 10^5
  • n1m2×n n - 1 \le m \le 2 \times n
  • 1u_i,v_in 1 \le u\_i, v\_i \le n