func_code_string: #include <bits/stdc++.h>   #pragma warning(disable : 4996)   using namespace std;   int main() {     ios::sync_with_stdio(false);     cin.tie(0);     long long t;     cin >> t;     while (t--) {       long long n, m, x, y;       cin >> n >> m >> x >> y;       if (2 * x < y) y = 2 * x;       vector<vector<long long>> grid(n, vector<long long>(m));       for (long long i = 0; i < n; i++) {         for (long long j = 0; j < m; j++) {           char c;           cin >> c;           if (c ==  . )             grid[i][j] = 0;           else             grid[i][j] = 1;         }       }       long long sum = 0;       for (long long i = 0; i < n; i++) {         vector<pair<long long, long long>> all;         all.push_back({grid[i][0], 1});         for (long long j = 1; j < m; j++) {           if (grid[i][j] == all.back().first)             all.back().second++;           else             all.push_back({grid[i][j], 1});         }         for (auto it : all) {           if (it.first == 0) {             long long a = it.second / 2, b = it.second % 2;             sum += a * y;             sum += b * x;           }         }       }       cout << sum <<   n ;     }     return 0;   }   