#include <iostream>
using namespace std;
int main() {
int n, m, x, y;
cin >> n >> m >> x >> y;
int arr[n][m];
int num = 0;
for(int i = 0; i < n; ++i) {
int dir, j;
if(i % 2 == 0){
j = 0;
dir = 1;
}
else {
j = m-1;
dir = -1;
}
for(; j < m&&j >= 0; j+= dir) {
arr[i][j] = num;
++num;
}
}
cout << arr[x - 1][y - 1];
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgp1c2luZyBuYW1lc3BhY2Ugc3RkOwoKaW50IG1haW4oKSB7CglpbnQgbiwgbSwgeCwgeTsKCWNpbiA+PiBuID4+IG0gPj4geCA+PiB5OwoJaW50IGFycltuXVttXTsKCWludCBudW0gPSAwOwoJZm9yKGludCBpID0gMDsgaSA8IG47ICsraSkgewoJCWludCBkaXIsIGo7CgkJaWYoaSAlIDIgPT0gMCl7CgkJCWogPSAwOwoJCQlkaXIgPSAxOwoJCX0KCQllbHNlIHsKCQkJaiA9IG0tMTsKCQkJZGlyID0gLTE7CgkJfQoJCWZvcig7IGogPCBtJiZqID49IDA7IGorPSBkaXIpIHsKCQkJYXJyW2ldW2pdID0gbnVtOwoJCQkrK251bTsKCQl9Cgl9Cgljb3V0IDw8IGFyclt4IC0gMV1beSAtIDFdOwoJcmV0dXJuIDA7Cn0=