#include #include #include #include #include #include #include #include #include #include #include #include #include #include #define rep(x, to) for (int x = 0; x < (to); x++) #define REP(x, a, to) for (int x = (a); x < (to); x++) #define foreach(itr, x) for (typeof((x).begin()) itr = (x).begin(); itr != (x).end(); itr++) using namespace std; typedef long long ll; typedef pair PII; typedef pair PLL; ll x, y; ll x2, y2; ll ans; ll diff(ll s, ll t, ll p, ll q) { ll res = (s*s + t*t) - (p*p + q*q); return res; } int main() { cin >> x >> y; cin >> x2 >> y2; ll tmp = min(abs(x), abs(y)); ans = tmp + (abs(x)-tmp) + (abs(y)-tmp); // 途中に歩兵 if (diff(x, y, x2, y2) > 0 && x * x2 + y * y2 > 0 && x * x2 - y * y2 == 0) { ans += 2; } cout << ans << endl; return 0; }