#include using namespace std; int main(){ int x,y,x2,y2,ans; cin >> x >> y; cin >> x2 >> y2; if(x>y) ans = x; else ans = y; if(x == y && x2 == y2 && x2 < x) ans--; cout << ans << endl; return 0; }