#include using namespace std; signed main(){ int X, Y; cin >> X >> Y; int X2, Y2; cin >> X2 >> Y2; int ans = max( X, Y ); if( abs( X ) == abs( Y ) and abs( X2 ) == abs( Y2 ) and X2 < X ) if( 1LL * X * X2 > 0 and 1LL * Y * Y2 > 0 ) ++ans; cout << ans << endl; return 0; }