#include <bits/stdc++.h>
int max(int a, int b) {
  if (a < b) return b;
  return a;
}
int f(int x1, int x2, int r1) {
  if (x1 == -x2) return 0;
  int ans = 0;
  if (x2 > r1) ans++;
  if (x1 >= -r1 && x1 < r1) ans++;
  if (x2 <= r1 && x1 < x2 - 1) ans++;
  if (x1 < 0) x1 = -x1 - 1;
  if (x2 > r1) x2 = r1 + 1;
  if (x2 - x1 > 2) ans += (x2 - x1 - 2) * 2;
  return ans;
}
int main() {
  int x1, r1, x2, r2;
  scanf("%d%d%d%d", &r1, &x1, &r2, &x2);
  if (x1 > x2) {
    int t = r1;
    r1 = r2;
    r2 = t;
    t = x1;
    x1 = x2;
    x2 = t;
  }
  long long sum = r1 + 1;
  for (int r = 1; r <= r2; r++) {
    sum += f(x2 - x1 - r, x2 - x1 + r, r1);
  }
  sum -=
      (x1 - max((x2 - r2), x1 - r1) > 0) ? (x1 - max((x2 - r2), x1 - r1)) : 0;
  printf("%lld", sum);
  return 0;
}
