#include <bits/stdc++.h>
using namespace std;
const int N = 300, mod = int(1e9) + 7;
int d[N][N], dp[N][N], n, m, Q, p;
char second[N][N];
vector<pair<int, int> > g[30];
int dx[4] = {0, 0, 1, -1};
int dy[4] = {-1, 1, 0, 0};
void bfs(int x, int y) {
  queue<pair<int, int> > q;
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) {
      d[i][j] = mod;
    }
  }
  int id = second[x][y] - 'A' + 1;
  d[x][y] = 0;
  q.push(make_pair(x, y));
  while (!q.empty()) {
    int x = q.front().first;
    int y = q.front().second;
    q.pop();
    dp[x][y] += ((id * Q) >> d[x][y]);
    if (d[x][y] >= 30) continue;
    for (int i = 0; i < 4; i++) {
      int xx = dx[i] + x;
      int yy = dy[i] + y;
      if (xx > 0 && yy > 0 && xx <= n && yy <= m && second[xx][yy] != '*' &&
          d[xx][yy] == mod) {
        d[xx][yy] = d[x][y] + 1;
        q.push(make_pair(xx, yy));
      }
    }
  }
}
int main() {
  scanf("%d%d%d%d", &n, &m, &Q, &p);
  for (int i = 1; i <= n; i++) {
    scanf("\n%s", second[i] + 1);
  }
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) {
      if (second[i][j] >= 'A' && second[i][j] <= 'Z') {
        bfs(i, j);
      }
    }
  }
  int ans = 0;
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) {
      if (dp[i][j] > p) {
        ans++;
      }
    }
  }
  printf("%d", ans);
  return 0;
}
