#include <bits/stdc++.h>
using namespace std;
long long n, m, p, po, res, g[255][255], f[255][255];
bool dd[255][255];
char s[255][255];
int dx[] = {0, 0, 1, -1};
int dy[] = {1, -1, 0, 0};
void setup() {
  cin >> n >> m >> po >> p;
  for (int i = 1; i <= n; ++i)
    for (int j = 1; j <= m; ++j) cin >> s[i][j];
}
void dfs(int x, int y, int val) {
  queue<pair<int, int> > q;
  q.push(make_pair(x, y));
  memset(dd, 0, sizeof(dd));
  memset(g, 0, sizeof(g));
  g[x][y] = val;
  f[x][y] += val;
  dd[x][y] = 1;
  while (!q.empty()) {
    int x = q.front().first;
    int y = q.front().second;
    q.pop();
    for (int i = 0; i < 4; ++i) {
      int fx = x + dx[i];
      int fy = y + dy[i];
      if (s[fx][fy] != '*' && !dd[fx][fy] && fx > 0 && fy > 0 && fx <= n &&
          fy <= m) {
        dd[fx][fy] = 1;
        g[fx][fy] = g[x][y] / 2;
        f[fx][fy] += g[fx][fy];
        if (g[fx][fy] > 1) q.push(make_pair(fx, fy));
      }
    }
  }
}
void work() {
  for (int i = 1; i <= n; ++i)
    for (int j = 1; j <= m; ++j)
      if (s[i][j] != '*' && s[i][j] != '.') dfs(i, j, po * (s[i][j] - 'A' + 1));
  for (int i = 1; i <= n; ++i)
    for (int j = 1; j <= m; ++j) res += f[i][j] > p;
  cout << res;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie();
  cout.tie();
  setup();
  work();
  return 0;
}
