#include using namespace std; int main(){ int x1,y1,x2,y2; cin >> x1 >> y1 >> x2 >> y2; int result = max(x1,y1); if(x1 == 0){ result += (x2 == 0 && y2 < y1); }else if(y1 == 0){ result += (y2 == 0 && x2 < x1); }else if(x1 == y1){ result += (x2 == y2 && x2 < x1); } cout << result << endl; }