QOJ.ac

QOJ

実行時間制限: 2.0 s メモリ制限: 512 MB 満点: 100

#77. Driving

統計

There are $N$ cities and $M$ bidirectional roads. The cities are numbered $1$ through $N$, and the roads are numbered $1$ through $M$. The road $i$ connects cities $A_i$ and $B_i$, and its length is $2^i$. It is guaranteed that you can reach from any city to any city using these roads.

Snuke wants to go driving. He wants to start from city $1$, pass through each road at least once, and return to city $1$. Compute the shortest possible length of his route, modulo $10^9 + 7$.

Input

$$ \begin{gathered} N\ M\\ A_1\ B_1\\ \vdots\\ A_M\ B_M \end{gathered} $$

  • $2 \le N \le 400000$
  • $1 \le M \le 500000$
  • $1 \le A_i, B_i \le N$
  • $A_i \ne B_i$
  • It is possible to reach from any city to any city using roads.
  • No two roads connect the same pair of cities.

Output

Print the shortest possible length of Snuke’s route, modulo $10^9 + 7$.

Examples

Input 1

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

Output 1

70

Input 2

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

Output 2

2132

Note

problem_77_65ce5a11226b24649ce2ca45e784ed44.png

For example, in sample 1 one optimal route is $1 \to 2 \to 3 \to 4 \to 2 \to 3 \to 1$.

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.