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 $N$ attributes in this game, numbered $1$ through $N$. Each attribute takes one of the two states, light or darkness. It means there are $2^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 $A$ to $B$ if and only if there exist two attributes $a$ and $b$ such that they satisfy the following four conditions:

* The state of attribute $a$ of character $A$ is light.

* The state of attribute $b$ of character $B$ is light.

* There exists no attribute $c$ such that both characters $A$ and $B$ have the light state of attribute $c$.

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




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

* $c_1 = a$.

* $c_n = b$.

* Either $(c_i, c_{i+1})$ or $(c_{i+1}, c_i)$ is a special pair for all $i = 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 $A$ and $B$ are essentially different if you cannot change character $A$ into character $B$ 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{,}007$.

Input

The input is a sequence of datasets. The number of datasets is not more than $50$ and the total size of input is less than $5$ MB.

Each dataset is formatted as follows.

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

The first line of each dataset contains two integers $N$ and $M$ ($1 \le N \le 10^5$ and $0 \le M \le 10^5$). Then $M$ lines follow. The $i$-th line contains two integers $a_i$ and $b_i$ ($1 \le a_i \lt b_i \le N$) which denote the $i$-th special pair. The input is terminated by two zeroes.

It is guaranteed that $(a_i, b_i) \ne (a_j, b_j)$ if $i \ne j$.

Output

For each dataset, output the number of essentially different characters modulo $1{,}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
#include <iostream>
#include <vector>
using namespace std;
typedef long long ll;

ll inf = 1e9+7;
class UnionFind{
private:
    vector<int> p,s;
	int cnt;
public:
	UnionFind(){}
	UnionFind(int N){
		cnt = N;
		p = s = vector<int>(N+1,0);
		for(int i=1;i<=N;i++){
			p[i] = i; s[i] = 1;
		}
	}
	int find(int x){
		if(p[x]==x) return x;
		else return p[x] = find(p[x]);
	}
	void unite(int x,int y){
		x = find(x); y = find(y);
		if(x==y) return;
		if(s[x]>s[y]){
			p[y] = x;
			s[x] += s[y];
		}else{
			p[x] = y;
			s[y] += s[x];
		}
		cnt--;
	}
	bool is_same_set(int x,int y) {return find(x)==find(y);}
	int size(int x) {return s[find(x)];}
	int compnents_number(){return cnt;}
};

int N,M;
int main(){
	while(cin >> N >> M && N>0){
		vector<ll> p2(N+1,1);
		vector<int> checked(N+1,0);
		for(int i=1;i<=N;i++) p2[i] = 2*p2[i-1]%inf;
		int a,b;
		UnionFind uf(N);
		for(int i=0;i<M;i++){
			cin >> a >> b;
			uf.unite(a,b);
		}
		ll ans = 1,num = 0;
		for(int i=1;i<=N;i++){
			if(!checked[uf.find(i)]){
				checked[uf.find(i)] = 1;
				if(uf.size(i)>=2) num++;
			}
		}
		int s = uf.compnents_number();
		if(s==1) cout << (N==1? 2:3) << endl;
		else if(s==N) cout << p2[N] << endl;
		else cout << (p2[s]+1)%inf << endl;
	}
}
