#define _USE_MATH_DEFINES #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include typedef long long int ll; //#include using namespace std; int main() { int Q; Q = 1; //cin >> Q; while (Q--) { int x, y, n; cin >> y >> x >> n; int ans = 0; if (x >= 0) { ans += x / n; if (x % n)ans++; if (y) { ans++; ans += abs(y / n); if (y % n)ans++; } } else { if (y) { ans++; ans += abs(y / n); if (y % n)ans++; ans++; } else { ans += 2; ans += abs(x / n); if (x % n)ans++; } } cout << ans << endl; } return 0; }