#include using namespace std; int main(){ ios::sync_with_stdio(false); cin.tie(0); int x, y; cin >> x >> y; int x2, y2; cin >> x2 >> y2; if(x == y && x2 == y2 && x2 < x && y2 < y) cout << max(x, y) + 1 << endl; else cout << max(x, y) << endl; return 0; }