#include <bits/stdc++.h>
using namespace std;
const int maxn = 305;
struct node {
  int x, y, val;
  node(int x = 0, int y = 0, int val = 0) : x(x), y(y), val(val) {}
};
long long val[maxn][maxn];
char maz[maxn][maxn];
int beused[maxn][maxn];
int dx[] = {1, 0, -1, 0};
int dy[] = {0, 1, 0, -1};
int n, m, a, b;
void bfs(int x, int y, int num) {
  queue<node> q;
  beused[x][y] = num;
  q.push(node(x, y, (maz[x][y] - 'A' + 1) * a));
  while (!q.empty()) {
    node nd = q.front();
    q.pop();
    if (nd.val == 0) continue;
    val[nd.x][nd.y] += nd.val;
    for (int i = 0; i < 4; i++) {
      int nx = nd.x + dx[i], ny = nd.y + dy[i];
      if (nx >= 1 && nx <= n && ny >= 1 && ny <= m && beused[nx][ny] != num &&
          maz[nx][ny] != '*') {
        beused[nx][ny] = num;
        q.push(node(nx, ny, nd.val / 2));
      }
    }
  }
}
void solve() {
  scanf("%d %d %d %d", &n, &m, &a, &b);
  for (int i = 1; i <= n; i++) scanf("%s", maz[i] + 1);
  int tot = 0;
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) {
      if (maz[i][j] >= 'A' && maz[i][j] <= 'Z') {
        bfs(i, j, ++tot);
      }
    }
  }
  int sum = 0;
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) {
      if (val[i][j] > b) sum++;
    }
  }
  printf("%d\n", sum);
}
int main() {
  solve();
  return 0;
}
