#include using namespace std; int main() { int x, y, x2, y2; cin >> x >> y >> x2 >> y2; cout << max(x, y) + ((x2 == 0 && x == 0) || (y2 == 0 && y == 0)) << endl; }