Under construction

Still being built. Things may change

Cactus Eater

Time limit2sMemory limit512 MB

Summary
Given a cactus, find the expected total energy released when a random vertex is repeatedly eaten and each remaining component is processed, modulo 998244353.
Level

Hard8 of 10

Topics
Graph, DFS, Dynamic programming, Probability
Solved
No attempts yet

Statement

As is well known, a cactus is a connected undirected graph without loops or multiple edges, in which every edge belongs to at most one simple cycle.

A microorganism called cactofagi, the cactus eater, was recently discovered. When it lands on a connected component, it does the following:

  1. It releases tt joules of energy, where tt is the number of vertices in the component.
  2. It chooses a random vertex in the component and eats it along with all edges incident to it.
  3. It moves to every connected component that remains.

Find the expected total energy released when the microorganism lands on a given cactus and the cactus is fully destroyed.

Input

The first line contains two integers nn and mm, the number of vertices and edges of the cactus (1≤n≤4001 \le n \le 400; 1≤m≤n(n−1)/21 \le m \le n(n-1)/2).

Each of the next mm lines contains two integers aa and bb, the vertices joined by an edge (1≤a,b≤n1 \le a,b \le n). It is guaranteed that the given graph is a cactus.

Output

It can be shown that the answer is a rational number. Write it as an irreducible fraction p/qp/q and print the value of pq−1 mod 998244353pq^{-1} \bmod 998244353.

Hint

In the second example the answer is 13.6, or 68/568/5 as an irreducible fraction.

Examples2

  1. Example 1

    Input
    4 3
    1 4
    2 4
    3 4
    
    Expected output
    9
    
  2. Example 2

    Input
    5 5
    1 2
    2 3
    3 4
    4 5
    5 2
    
    Expected output
    798595496