思路:
轮廓线dp
#include<bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define pi acos(-1.0)
#define LL long long
//#define mp make_pair
#define pb push_back
#define ls rt<<1, l, m
#define rs rt<<1|1, m+1, r
#define ULL unsigned LL
#define pll pair<LL, LL>
#define pii pair<int, int>
#define mem(a, b) memset(a, b, sizeof(a))
#define fio ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define fopen freopen("in.txt", "r", stdin);freopen("out.txt", "w", stout);
//head const int N = ;
const int MOD = 1e9 + ;
int dp[][<<N][];
int n, m, cur;
char mp[][N];
void update(int a, int b, int t) {
if(b & (<<m)) dp[cur][b^(<<m)][t] += dp[-cur][a][t-], dp[cur][b^(<<m)][t] %= MOD;
}
void Update(int a, int b, int t) {
if(b & (<<m)) dp[cur][b^(<<m)][t] += dp[-cur][a][t], dp[cur][b^(<<m)][t] %= MOD;
}
int main() {
int c, d;
while(~scanf("%d%d%d%d", &n, &m, &c, &d)) {
for (int i = ; i < n; i++) scanf("%s", mp[i]);
cur = ;
mem(dp, );
dp[cur][(<<m)-][] = ;
for (int i = ; i < n; i++) {
for (int j = ; j < m; j++) {
cur ^= ;
mem(dp[cur], );
if(mp[i][j] == '') {
for(int k = ; k < (<<m); k++) {
for (int l = ; l <= d; l++) {
Update(k, (k<<), l);
if(l)update(k, (k<<)^, l);
if(i && !(k & (<<m-))) Update(k, (k<<)^(<<m)^, l);
if(j && !(k & )) Update(k, (k<<)^, l);
}
}
}
else {
for (int k = ; k < (<<m); k++) {
for (int l = ; l <= d; l++) {
Update(k, (k<<)^, l);
}
}
}
}
}
LL ans = ;
for (int i = c; i <= d; i++) ans += dp[cur][(<<m)-][i], ans %= MOD;
printf("%lld\n", ans);
}
return ;
}