int input int input for in range 100000000000 if print break

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
a=int(input())
b=int(input())
m=[]
k=0
for i in range (100000000000):
k=a*i+1
j=(a*i+2)/b
if j%1==0:
print (k)
break