def main(): x = int(input()) y = int(input()) max_length = int(input()) if x == 0 and y > 0: operation = 0 elif y < 0: operation = 2 else: operation = 1 operation += abs(x // max_length + x % max_length) operation += abs(y // max_length + y % max_length) print(operation) if __name__ == '__main__': main()