#include <bits/stdc++.h>
using namespace std;
long long int n, m, p, q, total[255][255] = {0}, Ti = 0;
int dr[] = {0, 0, -1, 1}, dc[] = {1, -1, 0, 0};
vector<pair<long long int, pair<int, int> > > sources;
bool vis[255][255] = {0};
char table[255][255] = {0};
void bfs(const pair<long long int, pair<int, int> >& a) {
  memset(vis, 0, sizeof(vis));
  queue<pair<long long int, pair<int, int> > > q;
  q.push(a);
  while (!q.empty()) {
    pair<long long int, pair<int, int> > temp = q.front();
    q.pop();
    if (vis[temp.second.first][temp.second.second] || temp.first == 0) continue;
    vis[temp.second.first][temp.second.second] = 1;
    total[temp.second.first][temp.second.second] += temp.first;
    for (int i = 0; i <= 3; i++) {
      int r = temp.second.first + dr[i], c = temp.second.second + dc[i];
      if (table[r][c] == '.' || (table[r][c] >= 'A' && table[r][c] <= 'Z')) {
        q.push({temp.first / 2, {r, c}});
      }
    }
  }
}
int main() {
  ios_base::sync_with_stdio(0);
  cin >> n >> m >> q >> p;
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) {
      cin >> table[i][j];
      if (table[i][j] >= 'A' && table[i][j] <= 'Z') {
        long long int t = table[i][j] - 'A' + 1;
        t *= q;
        sources.push_back({t, {i, j}});
      }
    }
  }
  for (auto t : sources) {
    bfs(t);
  }
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++)
      if (total[i][j] > p) Ti++;
  }
  cout << Ti << endl;
  return 0;
}
