func_code_string: #include <bits/stdc++.h>   using namespace std;   int main() {     int t, n, m, x, y, cost, i, j;     string s;     cin >> t;     while (t--) {       cost = 0;       cin >> n >> m >> x >> y;       y = min(y, 2 * x);       for (i = 0; i < n; i++) {         cin >> s;         for (j = 0; j < m; j++) {           if (s[j] ==  . ) {             if (j + 1 < m && s[j + 1] ==  . )               cost += y, j++;             else               cost += x;           }         }       }       cout << cost << endl;     }   }   