#include<bits/stdc++.h>
using namespace std;
#define ff first
#define ss second
#define ll long long
#define io ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
ll M=1e9+7;
void cal(vector<ll>&v){
	v[0]=1;
	ll b=2;
	for(ll i=1;i<=4000000;i++){
		v[i]=b*v[i-1];
		v[i]%=M;
	}
	return ;
}

int main(){
	io;
	ll n,m;
	cin>>n>>m;
	string s[n];
	for(ll i=0;i<n;i++)cin>>s[i];
	ll tot=0;
	vector<vector<ll> >left(n,vector<ll>(m,0)),right(n,vector<ll>(m,0)),up(n,vector<ll>(m,0)),down(n,vector<ll>(m,0));
	for(ll i=0;i<n;i++){
		for(ll j=0;j<m;j++){
			if(s[i][j]=='.')tot++;
			if(s[i][j]=='#')continue;
			if(j-1>=0)left[i][j]=1+left[i][j-1];
			else left[i][j]=1;
			if(i-1>=0)up[i][j]=1+up[i-1][j];
			else up[i][j]=1;
		}
	}
	
	for(ll i=n-1;i>=0;i--){
		for(ll j=m-1;j>=0;j--){
			if(s[i][j]=='#')continue;
			if(j+1<m)right[i][j]=1+right[i][j+1];
			else right[i][j]=1;
			if(i+1<n)down[i][j]=1+down[i+1][j];
			else down[i][j]=1;
		}
	}
	
	vector<ll>v(4000004);
	cal(v);
	
	ll ans=0;
	for(ll i=0;i<n;i++){
		for(ll j=0;j<m;j++){
			if(s[i][j]=='#')continue;
			ll ilum=left[i][j]+right[i][j]+up[i][j]+down[i][j]-3;
			ll val=(v[ilum]-(ll)1);
			ll rem=tot-ilum;
			val*=(v[rem]);
		//	cout<<ilum<<" "<<rem<<" "<<tot<<endl;
			val%=M;
			ans+=val;
			ans%=M;
		}
	}
	cout<<ans<<endl;
	return 0;
}
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
//#pragma GCC optimize ("-O3")
using namespace std;
void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
typedef long long ll; const int inf = INT_MAX / 2; const ll infl = 1LL << 60;
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 (b < a) { a = b; return 1; } return 0; }
//---------------------------------------------------------------------------------------------------
vector<int> makePrimes(int n) { // [2,n]
    vector<int> res, pr(n + 1, 1);
    pr[0] = pr[1] = 0;
    rep(p, 2, sqrt(n) + 2) if (pr[p]) for (int x = p * 2; x <= n; x += p) pr[x] = 0;
    rep(p, 2, n + 1) if (pr[p]) res.push_back(p);
    return res;
}
/*---------------------------------------------------------------------------------------------------
　　　　　　　　　　　 ∧＿∧
　　　　　 ∧＿∧ 　（´<_｀ ）　 Welcome to My Coding Space!
　　　　 （ ´_ゝ`）　/　 ⌒i     @hamayanhamayan0
　　　　／　　　＼　 　  |　|
　　　 /　　 /￣￣￣￣/　　|
　 ＿_(__ﾆつ/　    ＿/ .| .|＿＿＿＿
　 　　　＼/＿＿＿＿/　（u　⊃
---------------------------------------------------------------------------------------------------*/














ll A, B;
ll dp[74][1 << 20];
int msk[73];
//---------------------------------------------------------------------------------------------------
void _main() {
    cin >> A >> B;

    auto ep = makePrimes(72);
    // cout << ep.size() << endl;     == 20

    for (ll x = A; x <= B; x++) rep(i, 0, 20) if (x % ep[i] == 0) msk[x - A] |= 1 << i;

    dp[0][0] = 1;
    for (ll x = A; x <= B; x++) rep(lcm, 0, 1 << 20) {
        if ((lcm & msk[x - A]) == 0) dp[x - A + 1][lcm | msk[x - A]] += dp[x - A][lcm];
        dp[x - A + 1][lcm] += dp[x - A][lcm];
    }

    ll ans = 0;
    rep(lcm, 0, 1 << 20) ans += dp[B - A + 1][lcm];
    cout << ans << endl;
}





