#include <bits/stdc++.h>
using namespace std;
long long n, m, x, y, ans;
void init() {
  cin >> n >> x >> m >> y;
  if (x > y) {
    swap(x, y);
    swap(n, m);
  }
}
void solve() {
  if (x == y) {
    ans = max(n, m) + 1;
    return;
  }
  ans = (n + 1);
  if (y >= x + n) {
    ans += min(m, y - x - n);
    m -= y - x - n;
    if (m > 0) ans += min(n * (n + 1), m * (m + 1));
    m -= n;
    if (m > 0) {
      if (m > n)
        ans += n * n;
      else
        ans += m * (2 * n - m);
    }
    m -= n;
  } else {
    long long a = y - x;
    long long b = x + n - y;
    long long c = y - x + n;
    long long d, r;
    while (m != 0 && (a > 0 || b > 0 || c > 0)) {
      if (a > 0 && b > 0) {
        d = min(min(a, b), m);
        ans += d * d * 2;
      } else if (a <= 0 && b <= 0) {
        d = min(m, c);
        ans += (2 * c - d) * d;
      } else {
        d = min(m, max(a, b));
        r = (y - x - a) * 2 - 1;
        if (a == 0)
          ans += d * (2 * r + 1);
        else
          ans += d * (2 * r + d + 3);
      }
      m -= d;
      a -= d;
      b -= d;
      c -= d;
    }
  }
  if (m > 0) ans += m;
}
void print() { cout << ans << endl; }
int main() {
  init();
  solve();
  print();
  return 0;
}
