#include #include #include using namespace std; struct Point { int x; int y; }; Point start = { 0, 0 }; Point goal; Point obst; int main(int argc, char *argv[]) { std::ios::sync_with_stdio(false); std::cin.tie(0); int cnt = 0; cin >> goal.x >> goal.y >> obst.x >> obst.y; if (goal.x >= goal.y) { cnt += goal.y + (goal.x - goal.y); } else { cnt += goal.x + (goal.y - goal.x); } if ((obst.x < goal.x) && (obst.y < goal.y)) { if ((obst.x == obst.y) && (goal.x == goal.y)) { cnt++; } } cout << cnt << endl; }