#include using namespace std; int main() { int X, Y, L; cin >> X >> Y >> L; int total = 0; if (X == 0 && Y == 0) { cout << total << endl; return 0; } if (Y != 0) { total += (abs(Y) % L == 0) ? abs(Y) / L : (abs(Y) / L) + 1; // 北に進む } if (X != 0) { total += (abs(X) % L == 0) ? abs(X) / L : (abs(X) / L) + 1; // 東に進む } if (X == 0 && Y > 0) { total += 0; } else if (X == 0 && Y < 0) { total += 2; } else if (X > 0 && Y == 0) { total += 1; } else if (X < 0 && Y == 0) { total += 1; } else if (X > 0 && Y > 0) { total += 1; } else if (X > 0 && Y < 0) { total += 2; } else if (X < 0 && Y > 0) { total += 1; } else if (X < 0 && Y < 0) { total += 2; } cout << total << endl; }