#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) { //1直線じょうにある ll dot = x * x2 + y * y2; ll cross = x * x2 - y * y2; if (dot > 0 && cross == 0) { // まっすぐ直線状 if (x == 0 || y == 0) ans += 2; // 対角線上(45) else if (abs(x) == abs(y)) ans += 1; } } cout << ans << endl; return 0; }