P26969 [AtCoder] Nice to Meet You
NOI
题目描述

Problem Description

In the Apple Sea, there are $N$ islands floating, and $M$ operators are running ferry services connecting these islands. For convenience, these islands are called Island $1, 2, \ldots, N$, and these operators are called Operator $1, 2, \ldots, M$.

The currents in the Apple Sea change significantly every day. Operator $i$ $(1 \leq i \leq M)$ operates either a ferry from Island $a_i$ to $b_i$ or from Island $b_i$ to $a_i$ depending on the day's sea conditions. Which direction the ferry runs is determined independently for each operator with equal probability.

Now, Takahashi is on Island $1$ and Hikahashi is on Island $2$. Using the ferry services provided by the $M$ operators, the probability that Takahashi and Hikahashi can meet on the same island that day is $P$. Note that travel time for the ferries is ignored. Here, $P \times 2^M$ is an integer. Find the remainder of $P \times 2^M$ when divided by $10^9 + 7$.

Input Format

The input is given from the standard input in the following format:

$N$ $M$ $a_1$ $b_1$ $:$ $a_M$ $b_M$

Output Format

Output the remainder of $P \times 2^M$ when divided by $10^9 + 7$.

Sample Input and Output

Sample Input #1

4 3
1 3
2 3
3 4

Sample Output #1

6

Sample Input #2

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

Sample Output #2

18

Sample Input #3

6 6
1 2
2 3
3 4
4 5
5 6
1 6

Sample Output #3

64

Notes/Hints

Constraints

  • $2 \leq N \leq 15$
  • $1 \leq M \leq N(N-1)/2$
  • $1 \leq a_i < b_i \leq N$
  • All pairs $(a_i, b_i)$ are distinct.

Sample Explanation 1

The $2^M = 8$ possible situations occur with equal probability, and among them, there are 6 situations where Takahashi and Hikahashi can meet on the same island. Therefore, $P = 6/2^M, P \times 2^M = 6$.

输入格式

见题面 Input 部分

输出格式

见题面 Output 部分

样例输入
4 3 1 3 2 3 3 4
样例输出
6