#include "bits/stdc++.h" using namespace std; int main() { int X, Y, X2, Y2; cin >> X >> Y >> X2 >> Y2; if (X == Y && X2 == Y2) cout << X + 1 << endl; else cout << max(X, Y) << endl; }