def divisor(num): div=[] for c in range(num): if num%(c+1)==0: div.append(c+1) return div num1=input("plese input your two favorite number\n") num2=input() num=num1+num2 check=0 for c in divisor(num): if (c+num1)%num2==0 and (c+num2)%num1==0 and num1!=c and num2!=c: print(c) check+=1 break if check==0: print(-1)