#include using namespace std; using ll = long long; int main(){ int x,y,x1,y1; cin >> x >> y >> x1 >> y1; int ans = max(x,y); if(x == y && x1 < x && x1 == y1) ans++; cout << ans << endl; return 0; }