#D4848. One-

    ID: 4032 Type: Default 8000ms 536MiB

One-

One-

Problem Statement

"Everlasting -One-" is an award-winning online game launched this year. This game has rapidly become famous for its large number of characters you can play.

In this game, a character is characterized by attributes. There are NN attributes in this game, numbered 11 through NN. Each attribute takes one of the two states, light or darkness. It means there are 2N2^N kinds of characters in this game.

You can change your character by job change. Although this is the only way to change your character's attributes, it is allowed to change jobs as many times as you want.

The rule of job change is a bit complex. It is possible to change a character from AA to BB if and only if there exist two attributes aa and bb such that they satisfy the following four conditions:

  • The state of attribute aa of character AA is light.

  • The state of attribute bb of character BB is light.

  • There exists no attribute cc such that both characters AA and BB have the light state of attribute cc.

  • A pair of attribute (a,b)(a, b) is compatible.

Here, we say a pair of attribute (a,b)(a, b) is compatible if there exists a sequence of attributes c1,c2,,cnc_1, c_2, \ldots, c_n satisfying the following three conditions:

  • c1=ac_1 = a.

  • cn=bc_n = b.

  • Either (ci,ci+1)(c_i, c_{i+1}) or (ci+1,ci)(c_{i+1}, c_i) is a special pair for all i=1,2,,n1i = 1, 2, \ldots, n-1. You will be given the list of special pairs.

Since you love this game with enthusiasm, you are trying to play the game with all characters (it's really crazy). However, you have immediately noticed that one character can be changed to a limited set of characters with this game's job change rule. We say character AA and BB are essentially different if you cannot change character AA into character BB by repeating job changes.

Then, the following natural question arises; how many essentially different characters are there? Since the output may be very large, you should calculate the answer modulo 1,000,000,0071{,}000{,}000{,}007.

Input

The input is a sequence of datasets. The number of datasets is not more than 5050 and the total size of input is less than 55 MB.

Each dataset is formatted as follows.

NN MM a1a_1 b1b_1 : : aMa_M bMb_M

The first line of each dataset contains two integers NN and MM (1N1051 \le N \le 10^5 and 0M1050 \le M \le 10^5). Then MM lines follow. The ii-th line contains two integers aia_i and bib_i (1ai<biN1 \le a_i \lt b_i \le N) which denote the ii-th special pair. The input is terminated by two zeroes.

It is guaranteed that (ai,bi)(aj,bj)(a_i, b_i) \ne (a_j, b_j) if iji \ne j.

Output

For each dataset, output the number of essentially different characters modulo 1,000,000,0071{,}000{,}000{,}007.

Sample Input

3 2 1 2 2 3 5 0 100000 0 0 0

Output for the Sample Input

3 32 607723520

Example

Input

3 2 1 2 2 3 5 0 100000 0 0 0

Output

3 32 607723520

inputFormat

outputFormat

output may be very large, you should calculate the answer modulo 1,000,000,0071{,}000{,}000{,}007.

Input

The input is a sequence of datasets. The number of datasets is not more than 5050 and the total size of input is less than 55 MB.

Each dataset is formatted as follows.

NN MM a1a_1 b1b_1 : : aMa_M bMb_M

The first line of each dataset contains two integers NN and MM (1N1051 \le N \le 10^5 and 0M1050 \le M \le 10^5). Then MM lines follow. The ii-th line contains two integers aia_i and bib_i (1ai<biN1 \le a_i \lt b_i \le N) which denote the ii-th special pair. The input is terminated by two zeroes.

It is guaranteed that (ai,bi)(aj,bj)(a_i, b_i) \ne (a_j, b_j) if iji \ne j.

Output

For each dataset, output the number of essentially different characters modulo 1,000,000,0071{,}000{,}000{,}007.

Sample Input

3 2 1 2 2 3 5 0 100000 0 0 0

Output for the Sample Input

3 32 607723520

Example

Input

3 2 1 2 2 3 5 0 100000 0 0 0

Output

3 32 607723520

样例

3 2
1 2
2 3
5 0
100000 0
0 0
3

32 607723520

</p>