#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
const int MAXN = 2010;
const int MOD = 1e9 + 7;
char a[MAXN][MAXN], b[MAXN][MAXN];
LL f[MAXN][MAXN];
int main(){
    int Hp, Wp, Hm, Wm;
    scanf("%d%d%d%d", &Hp, &Wp, &Hm, &Wm);
    for(int i = 1; i <= Hp; i++) scanf("%s", a[i] + 1);
    for(int i = 1; i <= Hm; i++) scanf("%s", b[i] + 1);
    LL target = 0;
    LL pow = 1;
    for(int i = 1; i <= Hp; i++) {
        LL tmp = 0;
        for(int j = Wp; j >= 1; j--)
            tmp = (tmp * 2 + (a[i][j]=='x'?1:0)) % MOD;
        target = (target + tmp * pow) % MOD;
        pow = pow * 3 % MOD;
    }
    //cout << target << endl;
    memset(f, 0, sizeof(f));
    LL Pow = 1;
    for(int i = 1; i <= Hm; i++){
        LL pow = 1;
        for(int j = 1; j <= Wm; j++) {
            f[i][j] = (f[i][j-1] + pow * (b[i][j]=='x'?1:0)) % MOD;
            pow = pow * 2 % MOD;
        }
        for(int j = 1; j <= Wm; j++) f[i][j] = (f[i][j] * Pow + f[i-1][j]) % MOD;
        Pow = Pow * 3 % MOD;
    }
    int ans = 0;
    Pow = 1;
    for(int i = 1; i <= Hm - Hp + 1; i++){
        LL pow = 1;
        for(int j = 1; j <= Wm - Wp + 1; j++){
            int x = i + Hp - 1, y = j + Wp - 1;
            LL tmp = (f[x][y] + f[i-1][j-1] - f[x][j-1] - f[i-1][y]) % MOD;
            tmp = (tmp + MOD) % MOD;
            LL tmp2 = ((target * pow % MOD) * Pow) % MOD;
            if(tmp == tmp2) {
                ans++;
                //cout << i << ' ' << j << endl;
            }
            //cout << tmp << endl;
            pow = pow * 2 % MOD;
        }
        Pow = Pow * 3 % MOD;
    }
    printf("%d\n", ans);
    return 0;
}
            

