# -*- coding: utf-8 -*- x = int(input()) y = int(input()) l = int(input()) result = -1 if x==0 and 0 0: result += 1 if y%l > 0: result += 1 print(result)