def sequence(equality,first = 0): current = first while True: yield current current+=equality A,B,C = map(int,input().split()) is_write = A * 60 >= B if is_write: A*=60 C*=60 ** 2 create = 0 hand = sequence(A) write = sequence(B,C) while next(write) >= next(hand): create+=1 result = create else: result = -1 print(result)