#include #include #include using namespace std; long getDirCmdCntZeroToGoal(long goalX, long goalY) { int cmdCnt = 0; if (goalX!=0) { ++ cmdCnt; if (goalY<0) { ++ cmdCnt; } } else { if (goalY<0) { cmdCnt = 2; } } return cmdCnt; } long getMoveCmdCntZeroToGoal(long dst, long minLen) { int cmdCnt = 0; if (dst==0) { return 0; } long goal = abs(dst); long mvLen = min(goal, minLen); long mvCnt = goal/mvLen; cmdCnt += mvCnt; if ( goal-(mvLen*mvCnt) > 0 ) { cmdCnt += 1; } return cmdCnt; } int main(int argc, char**argv) { long gx, gy, l; cin >> gx >> gy >> l; int cmdCnt = 0; cmdCnt += getDirCmdCntZeroToGoal( gx, gy ); cmdCnt += getMoveCmdCntZeroToGoal( gx, l); cmdCnt += getMoveCmdCntZeroToGoal( gy, l); cout << cmdCnt << endl; return 0; }