Under construction

Still being built. Things may change

Fast as Ryser

Time limit4sMemory limit512 MB

Summary
Sum c^|S| over all matchings S (edge sets with no shared vertex) in a graph with up to 36 vertices, modulo 1e9+7.
Level

Hard8 of 10

Topics
Graph, Bit manipulation, Dynamic programming, Divide and conquer
Solved
No attempts yet

Problem

After reading the paper Counting Perfect Matchings as Fast as Ryser, you learned how to count the number of perfect matchings in a general graph in O(2nn2)O(2^n n^2). So you decided to write this problem to encourage people to read the paper and learn new technology.

You are given an undirected graph with nn vertices and mm edges, and also a constant cc. We define the weight of an edge set SS as follows:

  • If there are two edges in set SS sharing common vertices, the weight is 0.
  • Otherwise, the weight is c∣S∣c^{|S|}. Note that the weight of an empty set is 1.

Compute the sum of the weight of all subsets of edges. The answer can be large, so output it modulo 109+710^9 + 7.

Input

The first line contains three integers nn, mm, cc (1≤n≤361 \le n \le 36, 0≤m≤n(n−1)/20 \le m \le n(n-1)/2, 1≤c≤109+61 \le c \le 10^9+6). Each of the following mm lines contains two integers uu, vv (1≤u,v≤n1 \le u, v \le n, u≠vu \ne v) indicating an undirected edge (u,v)(u, v) in the graph. All edges are distinct.

Output

Output one integer: the answer.

Examples2

  1. Example 1

    Input
    6 10 100
    3 6
    1 3
    2 4
    3 4
    4 6
    1 2
    4 5
    2 3
    1 4
    3 5
    
    Expected output
    2171001
    
  2. Example 2

    Input
    8 11 818466928
    6 7
    3 6
    6 5
    7 3
    6 2
    8 1
    1 7
    4 3
    5 1
    6 1
    6 4
    
    Expected output
    425176360