# frozen_string_literal: true def solve if B == 0 1 elsif A == -1 2 else -1 end end A, B = gets.split.map(&:to_i) puts solve