#include using namespace std; int main() { // 入力 int gx, gy, L; cin >> gx >> gy >> L; int ans = 0; int x, y; x = y = 0; if (x != gx || y != gy) { // 何回進行方向を変えればいいかを計算 if (gx == 0) { ans += (gy > 0 ? 0 : 2); } else if (gy == 0) { ans++; } else { if (gy > 0) { ans++; } else { ans += 2; } } // 前進させる命令を何回行えば良いかを計算 if (gx < 0) gx *= -1; if (gy < 0) gy *= -1; if (gx > 0) ans += (gx + L - 1) / L; if (gy > 0) ans += (gy + L - 1) / L; } // 解答 cout << ans << endl; return 0; }