#include <bits/stdc++.h>
using namespace std;
 
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define unused [[maybe_unused]]
#define tempT template<class T>
#define pcnt(x) __builtin_popcountll(x)
#define ALL(obj) (obj).begin(), (obj).end()
#define rALL(obj) (obj).rbegin(), (obj).rend()
#define isin(x, l, r) ((l) <= (x) && (x) < (r))
#define isin2d(i, j, h, w) (isin((i), 0, (h)) && isin((j), 0, (w)))
#define debug(x) cerr << #x << ": " << x << endl
#define ans_exit(x) { cout << (x) << endl; exit(0); }
#define ans_return(x) { cout << (x) << endl; return; }
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define r_rep(i, n) for (int i = (int)(n) - 1; i >= 0; i--)
#define reps(i, n, m) for (ll i = (ll)(n); i < (ll)(m); i++)
#define r_reps(i, n, m) for (ll i = (ll)(m) - 1; i >= (ll)(n); i--)
#define _dbgarr(a) {for(auto _e:(a)){cerr << _e << " ";} cerr << endl;}
#define printarr(a) {for(auto _e:(a)){cout << _e << " ";} cout << endl;}
#define debugarr(a) {cerr << #a << ": "; _dbgarr(a);}
 
using ll   unused = long long;
using ld   unused = long double;
using vl   unused = vector<ll>;
using vvl  unused = vector<vl>;
using vvvl unused = vector<vvl>;
using vstr unused = vector<string>;
using vb   unused = vector<bool>;
using lp   unused = pair<ll, ll>;
using lt   unused = tuple<ll, ll, ll>;
using lmap unused = map<ll, ll>;
 
unused constexpr ll MOD = 998244353;
unused constexpr ll INF = 1 << 29;
unused constexpr ll LINF = 1LL << 61;
unused constexpr double EPS = 1e-10;
unused constexpr int DX[8] = {0, 1, 0,-1, 1, 1,-1,-1};
unused constexpr int DY[8] = {1, 0,-1, 0, 1,-1, 1,-1};
unused inline bool bit(ll b, ll i) { return b & (1LL << i); }
unused inline ll ceiv(ll a, ll b) { return (a + b - 1) / b; }
unused inline ll mod(ll a, ll m = MOD) { return (a % m + m) % m; }
unused inline void modadd(ll &a, ll b, ll m = MOD) { a = mod(a + b, m); }
unused inline ll floordiv(ll a, ll b) { return a / b - (a < 0 && a % b); }
unused inline ll ceildiv(ll a, ll b) { return floordiv(a + b - 1, b); }
tempT unused bool chmin(T &a, T b) { if(a > b) {a = b; return 1;} return 0; }
tempT unused bool chmax(T &a, T b) { if(a < b) {a = b; return 1;} return 0; }

int main() {
    ll h, w; cin >> h >> w;
    vstr field(h); rep(i, h) cin >> field[i];

    set<char> chars[h + w - 1];
    rep(i, h) rep(j, w) {
        chars[i + j].insert(field[i][j]);
    }

    ll ans = 1;
    rep(i, h + w - 1) {
        if(chars[i].count('B') && chars[i].count('R')) {
            ans_exit(0);
        } else if(chars[i].count('.') && chars[i].size() == 1) {
            ans = (ans * 2) % MOD;
        }
    }
    cout << ans << endl;
}
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp> 
using namespace std;
using namespace __gnu_pbds; 
 
typedef tree<int, null_type, less<int>, rb_tree_tag, 
    tree_order_statistics_node_update>  nds;
#define pb push_back
#define mk make_pair
#define ff first
#define ss second
#define vi vector<int>
#define vc vector<char>
#define vs vector<string>
#define vpii vector<pair<int,int>> 
#define vpci vector<pair<char,int>>
#define vpcc vector<pair<char,char>> 
#define mi map<int,int> 
#define mc map<char,int>
#define mpii map<pair<int,int>,int> 
#define mpci map<pair<char,int>,int>
#define mpsi map<pair<string,int>,int>
#define ms map<string,int>
#define pii pair<int,int>
#define pc pair<char,char>
#define fbo find_by_order // (use *) value at  index in sorted array.
#define odk order_of_key  // tells index of element in array.
#define int long long int
#define double long double
#define inf 1e18
#define all(x) x.begin(),x.end()
#define allr(x) x.rbegin(),x.rend()
#define debug(x) cout<<x<<endl
#define debugc cout<<"!"<<endl
#define wt() int tt; cin>>tt;while(tt--)
# define f(x,a,b) for(int x = a; x <= b; x++)
# define fr(x,a,b) for(int x = b; x >= a; x--)
int max(int a,int b){return (a>=b)?a:b;}
int min(int a,int b){return (a<=b)?a:b;}
int dx[]={-1,0,1,0};
int dy[]={0,-1,0,1};
int rnd(int limit) 
{ 
    random_device rd;  
    mt19937 gen(rd()); 
    uniform_int_distribution<> dis(1, limit); 
    return dis(gen); 
}
int modInverse(int a, int m) 
{ 
    int m0 = m; 
    int y = 0, x = 1; 
    if (m == 1) 
        return 0; 
    while (a > 1) { 
        int q = a / m; 
        int t = m; 
        m = a % m, a = t; 
        t = y; 
        y = x - q * y; 
        x = t; 
    } 
    if (x < 0) 
        x += m0; 
    return x; 
}
vpii p;
void factors(int n)  
{  
    int cnt=0;
    while (n % 2 == 0)  
    {  
        cnt++;
        n = n/2;  
    }  
    if(cnt)
    p.pb({2,cnt});
    cnt=0;
    for (int i = 3; i <= sqrt(n); i = i + 2)  
    {  
        cnt=0;
        while (n % i == 0)  
        {  
            cnt++;  
            n = n/i;  
        }  
        p.pb({i,cnt});
    }  
    if (n > 2)  
    p.pb({n,1});
}

int mod=1e9+7;
const int N=2e6;
int fact[N+1], ifact[N+1];
int power(int a,int b) 
{
    if(b==0)
    return 1;
    int res=power(a,b/2);
    if(b&1)
    res = ((res%mod*res%mod)%mod*a)%mod;
    else
    res=(res%mod*res%mod)%mod;
    return res%mod;
}
void pre() 
{
	fact[0]=1;
	f(i,1,N)
	fact[i]=((fact[i-1]%mod)*i)%mod;
	//inverse
	ifact[N]=power(fact[N],mod-2)%mod;;
	fr(i,1,N)
	ifact[i-1]=((ifact[i])*i)%mod;
}
 
int ncr(int n,int r) 
{
	if(r>n)
	return 0;
	int ans=fact[n];
	ans=((ans%mod)*(ifact[n-r])%mod)%mod;
	ans=((ans%mod)*(ifact[r]%mod))%mod;
	return ans;
}
 
int npr(int n, int r) 
{
	if(r>n)
	return 0;
	int ans=fact[n];
	ans=((ans%mod)*(ifact[n-r])%mod)%mod;
	return ans;
}
// In mathematics problem just always avoid floating precision errors(We can avoid it by multipling 
//everyting with the number we are dividing) and also avoid mod on negative number mistakes(always add +mod)

// __gcd(x, y) = __gcd(x - y, x)

signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    pre();
    int n, m, k;
    cin>>n>>m>>k;
    if( n > m + k)
    {
		cout<<"0"<<endl;
		return 0;
	}
    int ans = (ncr(n + m, n) - ncr(n + m, n - k - 1) + mod) % mod;
    cout<<ans % mod<<endl;    
}
