#include #define fastIO (cin.tie(0), cout.tie(0), ios::sync_with_stdio(false)) #define precise(i) fixed << setprecision(i) #define rep(i, n) for (int i = 0; i < (int)(n); i++) using namespace std; int main() { fastIO; int x, y, l, cnt = 0; cin >> x >> y >> l; if(x == 0) { cnt = 0; } else if(y < 0) { cnt += 2; y *= -1; } else { cnt++; } if(x < 0) x *= -1; int distX = x / l + (x % l != 0); int distY = y / l + (y % l != 0); cout << distX + distY + cnt << '\n'; }