#include using namespace std; #define sorted(a) sort(a.begin(), a.end()); typedef long long ll; const long mod = 1e9 + 7; int main(void) { #ifdef DEBUG freopen("input.txt", "r", stdin); #endif ios_base::sync_with_stdio(false); cin.tie(NULL); int X, Y, X2, Y2; cin >> X >> Y; cin >> X2 >> Y2; if (X == Y && X2 == Y2 && X > X2) cout << X + 1 << endl; else cout << max(X, Y) << endl; return 0; }