My logic for CHECHOC:

Notice that we can divide each matrix into sub-matrices of size 2 x 1.

And each sub-matrix can have a maximum sum = min(2*x, y).

In case of odd m and n, a 1 x 1 matrix is left whose maximum sum can be min(x, y) .

This approach gives a WA. Can someone please provide a countercase?

@aneee004 @therealnishuz

```
#include <bits/stdc++.h>
#define vi vector<int>
#define pi pair<int, int>
#define vs vector<string>
#define ll long long int
#define pb push_back
#define mod 1000000007
#define INF 1e9
#define f first
#define s second
using namespace std;
int main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
int t;
cin >> t;
while(t--){
int n, m, x, y;
cin >> n >> m >> x >> y;
ll ans = 0;
if(m%2 == 0 || n%2 == 0) cout << ((m*n)/2)*min(2*x, y);
else{
cout << ((n*m)/2)*min(2*x, y) + min(x, y);
}
}
return 0;
}
```