#include <bits/stdc++.h>
#include <cctype>
#include <cstdlib>
#include <iostream>
#include <pthread.h>
#include <vector>
void one_piece() {
std::cin.tie(0);
std::cin.sync_with_stdio(0);
std::cout.tie(0);
std::cout.sync_with_stdio(0);
}
int main() {
one_piece();
int n, m, r, c;
std::cin >> n >> m >> r >> c;
int sum = 0;
int empty = ((r-1)*m) + c;
for(int i = 1; i <= n; i++) {
for(int j = 1; j <= m; j++) {
int id = ((i-1)*m) + j;
if(id > empty) {
if(id%m == 1) {
int newr = i - 1;
long long distance = std::abs(i - newr) + std::abs(j - m);
sum += distance;
} else {
int newc = j - 1;
long long distance = std::abs(i - i) + std::abs(j - newc);
sum += distance;
}
empty = id;
}
}
}
std::cout << sum;
return 0;
}
I2luY2x1ZGUgPGJpdHMvc3RkYysrLmg+CiNpbmNsdWRlIDxjY3R5cGU+CiNpbmNsdWRlIDxjc3RkbGliPgojaW5jbHVkZSA8aW9zdHJlYW0+CiNpbmNsdWRlIDxwdGhyZWFkLmg+CiNpbmNsdWRlIDx2ZWN0b3I+Cgp2b2lkIG9uZV9waWVjZSgpIHsKICBzdGQ6OmNpbi50aWUoMCk7CiAgc3RkOjpjaW4uc3luY193aXRoX3N0ZGlvKDApOwogIHN0ZDo6Y291dC50aWUoMCk7CiAgc3RkOjpjb3V0LnN5bmNfd2l0aF9zdGRpbygwKTsKfQoKCmludCBtYWluKCkgewogICAgb25lX3BpZWNlKCk7CgogICAgaW50IG4sIG0sIHIsIGM7CiAgICBzdGQ6OmNpbiA+PiBuID4+IG0gPj4gciA+PiBjOwoKICAgIGludCBzdW0gPSAwOwogICAgaW50IGVtcHR5ID0gKChyLTEpKm0pICsgYzsKCiAgICBmb3IoaW50IGkgPSAxOyBpIDw9IG47IGkrKykgewogICAgICAgIGZvcihpbnQgaiA9IDE7IGogPD0gbTsgaisrKSB7CiAgICAgICAgICAgIGludCBpZCA9ICgoaS0xKSptKSArIGo7CiAgICAgICAgICAgIGlmKGlkID4gZW1wdHkpIHsKICAgICAgICAgICAgICAgIGlmKGlkJW0gPT0gMSkgewogICAgICAgICAgICAgICAgICAgIGludCBuZXdyID0gaSAtIDE7CiAgICAgICAgICAgICAgICAgICAgbG9uZyBsb25nIGRpc3RhbmNlID0gc3RkOjphYnMoaSAtIG5ld3IpICsgc3RkOjphYnMoaiAtIG0pOwogICAgICAgICAgICAgICAgICAgIHN1bSArPSBkaXN0YW5jZTsKICAgICAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgICAgICAgaW50IG5ld2MgPSBqIC0gMTsKICAgICAgICAgICAgICAgICAgICBsb25nIGxvbmcgZGlzdGFuY2UgPSBzdGQ6OmFicyhpIC0gaSkgKyBzdGQ6OmFicyhqIC0gbmV3Yyk7CiAgICAgICAgICAgICAgICAgICAgc3VtICs9IGRpc3RhbmNlOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZW1wdHkgPSBpZDsKICAgICAgICAgICAgfQogICAgICAgIH0KICAgIH0KCiAgICBzdGQ6OmNvdXQgPDwgc3VtOwoKCiAgICByZXR1cm4gMDsKfQ==