Road Expansion Plan

Time limit: 0.7s Memory limit: 256MB Input: Output:

The city of Pordenone is planning an expansion of its road network. There are NN towns (clearly indexed from 00 to N1N-1) in Pordenone’s hinterland and MM bidirectional roads connecting some pairs of towns.

An expansion plan is any set of roads that contains the currently present roads. E. Domora, the mayor of Pordenone, cannot choose an expansion plan among all the possible ones and is in desperate need of your analytical skills.

A cluster CC of towns is a non-empty set of towns such that, for each tCt \in C and any other town uu, there exists a set of roads connecting (possibly indirectly) tt and uu if and only if uCu \in C. Note that, given a road network, there is an unique way to partition the towns in clusters.

Task

Given a road network, its Scoazza™ Score is 2k2^k, where kk is the number of clusters in which it partitions the towns; Mayor Domora is asking you to compute the sum of the Scoazza™ Scores of all possible expansion plans.

Since this number can be big, output it modulo 998 244 353998 \ 244 \ 353.

Input data

The input file consists of:

  • a line containing integers NN, MM.
  • a line containing the MM integers U0,,UM1U_0, \dots, U_{M−1}.
  • a line containing the MM integers V0,,VM1V_0, \dots, V_{M−1}.

Output data

The output file must contain a single line consisting of a single integer: the answer to the problem.

Constraints and clarifications

  • 1N100 0001 \leq N \leq 100 \ 000
  • 1M200 0001 \leq M \leq 200 \ 000
  • 0Ui,Vi<N0 \leq U_i,V_i < N for each 0iM10 \leq i \leq M-1
  • All the roads are distinct.
# Points Constraints
1 0 Examples
2 17 N7N \leq 7
3 40 N1 000N \leq 1 \ 000
4 43 No additional constraints

Example 1

stdin

4 3
0 1 2
1 2 0

stdout

18

Explanation


There are 44 towns and 33 roads already built:

  1. The road connecting town 00 and town 11.
  2. The road connecting town 11 and town 22.
  3. The road connecting town 22 and town 00.

There are 33 possible roads that can be built:

  1. The road connecting town 00 and town 33.
  2. The road connecting town 11 and town 33.
  3. The road connecting town 22 and town 33.

There are 88 possible expansion plans:

  1. The one in which no road is added. In this case there will be 22 clusters: 0,1,20, 1, 2 and 33.
  2. The one in which only the road connecting towns 00 and 33 is added. In this case there will be a single cluster: 0,1,2,30, 1, 2, 3.
  3. etc.

Note that, following any other expansion plan will lead to a single cluster containing all the cities. The answer is hence 22+21+21+21+21+21+21+21=182^2 + 2^1 + 2^1 + 2^1 + 2^1 + 2^1 + 2^1 + 2^1 = 18.

Example 2

stdin

10 8
0 1 2 3 7 6 4 8
1 2 0 4 5 7 9 9

stdout

360988397

Explanation

There are 1010 towns and 88 roads already built:

Log in or sign up to be able to send submissions!