#ABC244E. [ABC244E] King Bombee

[ABC244E] King Bombee

Score : 500500 points

Problem Statement

You are given a simple undirected graph with NN vertices and MM edges. The vertices are numbered from 11 through NN, and the edges are numbered from 11 through MM. Edge ii connects Vertex UiU_i and Vertex ViV_i.

You are given integers K,S,TK, S, T, and XX. How many sequences A=(A0,A1,,AK)A = (A_0, A_1, \dots, A_K) are there satisfying the following conditions?

  • AiA_i is an integer between 11 and NN (inclusive).
  • A0=SA_0 = S
  • AK=TA_K = T
  • There is an edge that directly connects Vertex AiA_i and Vertex Ai+1A_{i+1}.
  • Integer X (XS,XT)X\ (X \neq S,X \neq T) appears even number of times (possibly zero) in sequence AA.

Since the answer can be very large, find the answer modulo 998244353998244353.

Constraints

  • All values in input are integers.
  • 2N20002 \leq N \leq 2000
  • 1M20001 \leq M \leq 2000
  • 1K20001 \leq K \leq 2000
  • 1S,T,XN1 \leq S,T,X \leq N
  • XSX \neq S
  • XTX \neq T
  • $1 \leq U_i
  • If iji \neq j, then (Ui,Vi)(Uj,Vj)(U_i, V_i) \neq (U_j, V_j).

Input

Input is given from Standard Input in the following format:

NN MM KK SS TT XX

U1U_1 V1V_1

U2U_2 V2V_2

\vdots

UMU_M VMV_M

Output

Print the answer modulo 998244353998244353.

4 4 4 1 3 2
1 2
2 3
3 4
1 4
4

The following 44 sequences satisfy the conditions:

  • (1,2,1,2,3)(1, 2, 1, 2, 3)
  • (1,2,3,2,3)(1, 2, 3, 2, 3)
  • (1,4,1,4,3)(1, 4, 1, 4, 3)
  • (1,4,3,4,3)(1, 4, 3, 4, 3)

On the other hand, (1,2,3,4,3)(1, 2, 3, 4, 3) and (1,4,1,2,3)(1, 4, 1, 2, 3) do not, since there are odd number of occurrences of 22.

6 5 10 1 2 3
2 3
2 4
4 6
3 6
1 5
0

The graph is not necessarily connected.

10 15 20 4 4 6
2 6
2 7
5 7
4 5
2 4
3 7
1 7
1 4
2 9
5 10
1 3
7 8
7 9
1 6
1 2
952504739

Find the answer modulo 998244353998244353.