#include <bits/stdc++.h>
using namespace std;
namespace IO {
inline long long read() {
  long long s = 0, ww = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') ww = -1;
    ch = getchar();
  }
  while ('0' <= ch && ch <= '9') {
    s = 10 * s + ch - '0';
    ch = getchar();
  }
  return s * ww;
}
void write(long long x) {
  if (x < 0) putchar('-'), x = -x;
  if (x > 9) write(x / 10);
  putchar('0' + x % 10);
}
};  // namespace IO
using namespace IO;
inline void chkmin(long long &x, long long y) {
  if (y < x) x = y;
}
inline void chkmax(long long &x, long long y) {
  if (y > x) x = y;
}
inline long long abs(long long a, long long b) {
  long long ans = a - b;
  return ans >= 0 ? ans : -ans;
}
inline long long max(long long a, long long b) { return a > b ? a : b; }
inline long long min(long long a, long long b) { return a > b ? b : a; }
void solve() {
  long long n = read(), x = read(), m = read(), y = read();
  long long ans = n + 1;
  x = abs(x - y);
  if (n <= x) {
    if (x - n < m) {
      m -= x - n;
      ans += x - n;
      if (m < n)
        ans += m * (m + 1);
      else {
        m -= n;
        ans += n * (n + 1);
        if (m > n)
          ans += n * n + m - n;
        else
          ans += (2 * n - m) * m;
      }
    } else
      ans += m;
  } else {
    long long d = n - x;
    if (x >= d) {
      if (m <= d)
        ans += 2 * m * m;
      else {
        m -= d;
        ans += 2 * d * d;
        if (m <= x - d)
          ans += m * (1 + 4 * d + m);
        else {
          m -= x - d;
          ans += (x - d) * (1 + 3 * d + x);
          if (m < n)
            ans += (2 * n - m) * m;
          else {
            ans += n * n + m - n;
          }
        }
      }
    } else {
      if (m <= x)
        ans += 2 * m * m;
      else {
        m = m - x;
        ans += 2 * x * x;
        if (m < d - x)
          ans += (4 * x - 1) * m;
        else {
          ans += (4 * x - 1) * (d - x);
          m -= d - x;
          if (m < 2 * x)
            ans += m * (4 * x - m);
          else {
            ans += 4 * x * x + m - 2 * x;
          }
        }
      }
    }
  }
  write(ans);
  putchar('\n');
}
int main() {
  solve();
  return 0;
}
