#include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; long long MOD = 1000000007; int main() { long long x1,x2,y1,y2; cin >> x1 >> y1 >> x2 >> y2; if ( x1 == y1 && x2 == y2 && x1 > x2 ) { cout << x1 + 1 << endl; } else { cout << max( x1, y1 ) << endl; } return 0; }