#include <bits/stdc++.h>   using namespace std;   const int maxn = 7e5 + 10;   const int inf = 0x3f3f3f3f;   int n, m, p, q, nx, ny;   long long sum[300][300];   int dis[300][300];   int dx[4] = {0, 0, 1, -1}, dy[4] = {1, -1, 0, 0};   char maze[300][300];   void bfs(int sx, int sy, long long k) {     dis[sx][sy] = 0, sum[sx][sy] += k;     queue<pair<pair<int, int>, int> > q;     q.push(make_pair(make_pair(sx, sy), k));     while (q.empty() == 0) {       pair<pair<int, int>, int> tmp = q.front();       q.pop();       for (int i = 0; i < 4; i++) {         nx = tmp.first.first + dx[i], ny = tmp.first.second + dy[i];         if (nx >= 1 && nx <= n && ny >= 1 && ny <= m && maze[nx][ny] !=  *  &&             dis[nx][ny] == inf) {           dis[nx][ny] = dis[tmp.first.first][tmp.first.second] + 1;           int res = tmp.second / 2;           if (res <= 0) {             break;           }           sum[nx][ny] += res;           q.push(make_pair(make_pair(nx, ny), res));         }       }     }   }   int main() {     ios_base::sync_with_stdio(false);     cin >> n >> m >> q >> p;     memset(sum, 0, sizeof(sum));     int cnt = 0;     for (int i = 1; i <= n; i++) {       cin >> maze[i] + 1;     }     for (int i = 1; i <= n; i++) {       for (int j = 1; j <= m; j++) {         if (maze[i][j] >=  A  && maze[i][j] <=  Z ) {           memset(dis, inf, sizeof(dis));           bfs(i, j, (maze[i][j] -  A  + 1) * q);         }       }     }     int ans = 0;     for (int i = 1; i <= n; i++) {       for (int j = 1; j <= m; j++) {         if (sum[i][j] > p && maze[i][j] !=  * ) {           ans++;         }       }     }     cout << ans << endl;     return 0;   }   