#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int r1, r2, a1, a2, k;
  cin >> r1 >> a1 >> r2 >> a2;
  k = abs(a1 - a2);
  if (r2 > r1) {
    a1 = r1;
    r1 = r2;
    r2 = a1;
  }
  if (k == 0)
    cout << r1 + 1;
  else if (r1 + r2 <= k)
    cout << r1 + r2 + 1;
  else if (r1 <= k && k < r1 + r2)
    cout << k + 1 + (r1 + r2 - k) * (r1 + r2 - k + 1);
  else if (r2 <= k && k < r1 && r1 <= k + r2)
    cout << r1 + 1 + 2 * r2 * r2 - (r2 - r1 + k) * (r2 - r1 + k - 1);
  else if (r2 <= k && k < r1 && r1 > k + r2)
    cout << r1 + 1 + 2 * r2 * r2;
  else if (r2 > k && r1 >= k + r2)
    cout << 2 * r2 * r2 - 2 * (r2 - k) * (r2 - k) + r1 - r2 + k + 1;
  else if (r2 > k && r1 < k + r2)
    cout << 2 * r2 * r2 - 2 * (r2 - k) * (r2 - k) + r1 - r2 + k + 1 -
                (r2 + k - r1) * (r2 + k - r1 - 1);
}
