#include using namespace std; int main() {int x, y, xx, yy; cin >> x >> y >> xx >> yy;cout << max(x, y) + (x == y && xx == yy && xx < x);return 0;}