#include using namespace std; const std::vector dx = {1, -1, 0, 0, 1, 1, -1, -1}, dy = {0, 0, 1, -1, 1, -1, 1, -1}; int main() { ios::sync_with_stdio(false); cin.tie(nullptr); int gx, gy, ngx, ngy; cin >> gx >> gy >> ngx >> ngy; if (ngx < gx && ngy < gy && ngx == ngy && gx == gy) { cout << max(gx, gy) + 1 << '\n'; } else { cout << max(gx, gy) << '\n'; } return 0; }