The king demon is waiting in his dungeon to defeat a brave man. His dungeon consists of H \times W grids. Each cell is connected to four (i.e. north, south, east and west) neighboring cells and some cells are occupied by obstacles.

To attack the brave man, the king demon created and sent a servant that walks around in the dungeon. However, soon the king demon found that the servant does not work as he wants. The servant is too dumb. If the dungeon had cyclic path, it might keep walking along the cycle forever.

In order to make sure that the servant eventually find the brave man, the king demon decided to eliminate all cycles by building walls between cells. At the same time, he must be careful so that there is at least one path between any two cells not occupied by obstacles.

Your task is to write a program that computes in how many ways the kind demon can build walls.



Input

The first line of each test case has two integers H and W (1 \leq H \leq 500, 1 \leq W \leq 15), which are the height and the width of the dungeon. Following H lines consist of exactly W letters each of which is '.' (there is no obstacle on the cell) or '#' (there is an obstacle). You may assume that there is at least one cell that does not have an obstacle.

The input terminates when H = 0 and W = 0. Your program must not output for this case.

Output

For each test case, print its case number and the number of ways that walls can be built in one line. Since the answer can be very big, output in modulo 1,000,000,007.

Example

Input

2 2
..
..
3 3
...
...
..#
0 0


Output

Case 1: 4
Case 2: 56
#include <cstdio>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <climits>
#include <ctime>
#include <queue>
#include <stack>
#include <algorithm>
#include <list>
#include <vector>
#include <set>
#include <map>
#include <iostream>
#include <deque>
#include <complex>
#include <string>
#include <iomanip>
#include <sstream>
#include <bitset>
#include <valarray>
#include <unordered_map>
#include <iterator>
#include <functional>
#include <cassert>
using namespace std;
typedef long long int ll;
typedef unsigned int uint;
typedef unsigned char uchar;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;

#define REP(i,x) for(int i=0;i<(int)(x);i++)
#define REPS(i,x) for(int i=1;i<=(int)(x);i++)
#define RREP(i,x) for(int i=((int)(x)-1);i>=0;i--)
#define RREPS(i,x) for(int i=((int)(x));i>0;i--)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();i++)
#define RFOR(i,c) for(__typeof((c).rbegin())i=(c).rbegin();i!=(c).rend();i++)
#define ALL(container) (container).begin(), (container).end()
#define RALL(container) (container).rbegin(), (container).rend()
#define SZ(container) ((int)container.size())
#define mp(a,b) make_pair(a, b)
#define pb push_back
#define eb emplace_back
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );

template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }
template<class T> ostream& operator<<(ostream &os, const vector<T> &t) {
os<<"["; FOR(it,t) {if(it!=t.begin()) os<<","; os<<*it;} os<<"]"; return os;
}
template<class T> ostream& operator<<(ostream &os, const set<T> &t) {
os<<"{"; FOR(it,t) {if(it!=t.begin()) os<<","; os<<*it;} os<<"}"; return os;
}
template<class S, class T> ostream& operator<<(ostream &os, const map<S, T> &t) {
os<<"{"; FOR(it,t) {if(it!=t.begin()) os<<","; os<<*it;} os<<"}"; return os;
}
template<class S, class T> ostream& operator<<(ostream &os, const pair<S,T> &t) { return os<<"("<<t.first<<","<<t.second<<")";}
template<class S, class T> pair<S,T> operator+(const pair<S,T> &s, const pair<S,T> &t){ return pair<S,T>(s.first+t.first, s.second+t.second);}
template<class S, class T> pair<S,T> operator-(const pair<S,T> &s, const pair<S,T> &t){ return pair<S,T>(s.first-t.first, s.second-t.second);}

const int INF = 1<<28;
const double EPS = 1e-8;
const int MOD = 1000000007;

typedef unordered_map<int, int> Array;
typedef vector<Array> Matrix;
ostream& operator<<(ostream &os, const Array &t) {
os<<"["; FOR(it,t) {if(it!=t.begin()) os<<","; os<<*it;} os<<"]"; return os;
}
ostream& operator<<(ostream &os, const Matrix &t) {
FOR(it,t)os<<*it<<endl;return os;
}

int T, n, m;

inline ll mod_inv(ll a, ll m){
  ll b = m, u = 1, v = 0;
  while (b) {
    ll t = a / b;
    swap(a -= t * b, b);
    swap(u -= t * v, v);
  }
  return (u % m + m) % m;
}


int det(Matrix mat){
	int n = mat.size();
	ll ans = 1;
	REP(i, n){
		ans = ans * mat[i][i] % MOD;
		if(!ans) return ans;
		ll inv = mod_inv(mat[i][i], MOD);
		for(int j=i+1;j<n;j++)if(mat[j].count(i)){
			ll coef = (MOD - mat[j][i] * inv % MOD) % MOD;
			for(auto it : mat[i]){
				auto &jt = mat[j][it.first];
				jt = (jt + coef*it.second) % MOD;
				if(jt == 0) mat[j].erase(it.first);
			}
		}
	}
	return ans;
}

int main(int argc, char *argv[]){
	ios::sync_with_stdio(false);
	int T = 1;
	while(cin >> n >> m, n){
		vector<string> s(n);
		REP(i, n) cin >> s[i];
		vi to(n*m);
		int c = 0;
		Matrix mat;
		REP(i, n*m){
			int x = i%m;
			int y = i/m;
			if(s[y][x] == '#') continue;
			mat.eb();
			if(x && s[y][x-1] != '#'){
				mat[c][c] ++; mat[c-1][c-1] ++;
				mat[c][c-1] = mat[c-1][c] = MOD-1;
			}
			if(y && s[y-1][x] != '#'){
				mat[c][c] ++; mat[to[i-m]][to[i-m]] ++;
				mat[c][to[i-m]] = mat[to[i-m]][c] = MOD-1;
			}
			to[i] = c++;
		}
		REP(i, c-1) mat[i].erase(c-1);
		mat.pop_back();
		cout << "Case " << T++ << ": " << det(mat) << endl;
	}
	return 0;
}