#include using namespace std; #include #include #include #include #define FOR(i,a,b) for(int (i)=(a);i<(b);i++) typedef long long ll; typedef unsigned long long ull; typedef long double lb; /* ここからが本編 */ int main(void) { int i,j,k,l; int x,y; int x2,y2; int ans; cin >> x >> y; cin >> x2 >> y2; if(x * x2 < 0) { x2 = -1; y2 = -1; } else if( y * y2 < 0) { x2 = -1; y2 = -1; } x = abs(x); y = abs(y); if(x > y) ans = x; else if(x < y) ans = y; /* こっからはx == yの条件が自然につく */ else if(x > 2) { ans = x; if(x2 == y2 && x2 > 0) ans += 1; } else if(x == 1) ans = 1; else if(x == 2) { if(x2 == 1 && y2 == 1) ans = 4; else ans = 2; } printf("%d\n",ans); return 0; }