#include <bits/stdc++.h>
using namespace std;
const int MAXN = (1 << 8);
int64_t pw2[MAXN];
int n, m, q, p;
string a[MAXN];
void read() {
  cin >> n >> m >> q >> p;
  for (int i = 0; i < n; i++) cin >> a[i];
}
int used[MAXN][MAXN];
int64_t sum[MAXN][MAXN];
pair<int, int> Q[1 << 22];
int qst = 0, qen = 0;
int dirx[4] = {-1, 1, 0, 0};
int diry[4] = {0, 0, 1, -1};
int d[MAXN][MAXN];
void solve(int i, int j, int inital_power, int falseU) {
  qst = 0;
  qen = 0;
  Q[qen++] = {i, j};
  used[i][j] = falseU;
  d[i][j] = 0;
  while (qst < qen) {
    pair<int, int> u = Q[qst++];
    if (inital_power / pw2[d[u.first][u.second]] == 0) continue;
    sum[u.first][u.second] += inital_power / pw2[d[u.first][u.second]];
    for (int D = 0; D < 4; D++) {
      int x = u.first + dirx[D], y = u.second + diry[D];
      if (x >= 0 && y >= 0 && x < n && y < m && a[x][y] != '*' &&
          used[x][y] != falseU) {
        used[x][y] = falseU;
        d[x][y] = d[u.first][u.second] + 1;
        Q[qen++] = {x, y};
      }
    }
  }
}
void solve() {
  pw2[0] = 1;
  for (int i = 1; i < MAXN; i++) pw2[i] = pw2[i - 1] * 2ll;
  int cnt = 0;
  for (int i = 0; i < n; i++)
    for (int j = 0; j < m; j++)
      if (a[i][j] >= 'A' && a[i][j] <= 'Z')
        solve(i, j, (a[i][j] - 'A' + 1) * q, ++cnt);
  int ans = 0;
  for (int i = 0; i < n; i++)
    for (int j = 0; j < m; j++)
      if (sum[i][j] > p) ans++;
  cout << ans << '\n';
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  read();
  solve();
  return 0;
}
