#include using namespace std; int main(){ int x,y,a,b;cin>>x>>y>>a>>b; if (x == y) { cout << (a == b ? x + 1 : x) << endl; } else if (x == 0) { cout << (a == 0 ? y + 1 : y) << endl; } else if (y == 0) { cout << (b == 0 ? x + 1 : x) << endl; } else { cout << max(a, b) << endl; } }