#include #include #include #include #include using namespace std; int main(){ int goal[2]; int teki[2]; int goal_h[2]; int teki_h[2]; int adjust = 0; cin >> goal[0] >> goal[1] >> teki[0] >> teki[1]; //斜め if(abs(goal[0]) == abs(goal[1]) && abs(teki[0]) == abs(teki[1]) ){ //符号調査 for(int i=0; i<2; i++){ if(goal[i] == 0){ goal_h[i] = 0; }else if(goal[i] < 0){ goal_h[i] = -1; }else{ goal_h[i] = 1; } } for(int i=0; i<2; i++){ if(teki[i] == 0){ teki_h[i] = 0; }else if(teki[i] < 0){ teki_h[i] = -1; }else{ teki_h[i] = 1; } } //斜め if(goal_h[0] == teki_h[0] && goal_h[1] == teki_h[1] && abs(teki[0]) < abs(goal[0]) && abs(teki[1]) < abs(goal[1])){ adjust = 1; }else{ adjust = 0; } }else{ adjust = 0; } cout << max(abs(goal[0]), abs(goal[1])) + adjust << endl; return 0; }