# -*- coding: utf-8 -*- import sys # nums = tuple(map(int, input().split())) x = int(input()) y = int(input()) l = int(input()) result = -1 if x == 0 and y == 0: print('0') sys.exit() if x==0 and 0 0: result += 1 if y%l > 0: result += 1 print(result)