func_code_string: #include <bits/stdc++.h>   using namespace std;   int main() {     long long t, n, m, k, rem, each, x, y, i, j, ans;     cin >> t;     while (t--) {       cin >> n >> m >> x >> y;       string s[n];       long long one = 0, two = 0;       for (i = 0; i < n; i++) {         cin >> s[i];       }       for (i = 0; i < n; i++) {         for (j = 0; j < m; j++) {           if (s[i][j] ==  . ) one++;           if (j == 0) continue;           if (s[i][j] ==  .  && s[i][j - 1] ==  . ) {             two++;             s[i][j] =  $ ;             s[i][j - 1] =  $ ;           }         }       }       long long p1, p2;       p1 = x * one;       p2 = y * two + x * (one - two * 2);       ans = min(p1, p2);       cout << ans << endl;     }   }   