#include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; typedef long long ll; typedef pair pi; typedef pair pl; typedef pair pls; int main() { ll x, y, x2, y2; cin >> x >> y >> x2 >> y2; ll ans = max(x, y); if ((x == y) && (x2 == y2)) ans++; cout << ans << endl; return 0; }