#include <bits/stdc++.h>   using namespace std;   template <typename _T>   inline void _DBG(const char *s, _T x) {     cerr << s <<   =   << x <<   n ;   }   template <typename _T, typename... args>   void _DBG(const char *s, _T x, args... a) {     while (*s !=  , ) cerr << *s++;     cerr <<   =   << x <<  , ;     _DBG(s + 1, a...);   }   const int N = 307;   int n, m, p[] = {1, 0, 0, 1, -1, 0, 0, -1};   char s[N][N];   long long P, q;   long long val[N][N];   queue<pair<pair<int, int>, long long> > Q;   bool vis[N][N];   vector<pair<int, int> > kto;   void bfs(int x, int y, long long v) {     Q.push({{x, y}, v});     for (auto xx : kto) vis[xx.first][xx.second] = 0;     kto.clear();     vis[x][y] = 1;     while (!Q.empty()) {       int xx = Q.front().first.first, yy = Q.front().first.second;       long long vv = Q.front().second;       val[xx][yy] += vv;       Q.pop();       kto.push_back({xx, yy});       vv /= 2;       if (vv == 0) continue;       for (int i = 0; i < 8; i += 2) {         int ux = xx + p[i], uy = yy + p[i + 1];         if (s[ux][uy] ==  * ) continue;         if (1 > ux || ux > n || 1 > uy || uy > m) continue;         if (!vis[ux][uy]) {           vis[ux][uy] = 1;           Q.push({{ux, uy}, vv});         }       }     }   }   int main() {     ios_base::sync_with_stdio(0);     cin.tie(0);     cout.tie(0);     cin >> n >> m >> q >> P;     for (int i = 1; i <= n; i++) cin >> (s[i] + 1);     for (int i = 1; i <= n; i++) {       for (int j = 1; j <= m; j++) {         if ( A  <= s[i][j] && s[i][j] <=  Z ) {           long long vv = (long long)(s[i][j] -  A  + 1) * q;           bfs(i, j, vv);         }       }     }     int ans = 0;     for (int i = 1; i <= n; i++)       for (int j = 1; j <= m; j++) {         if (val[i][j] > P) ans++;       }     cout << ans <<   n ;     return 0;   }   