inputer = input() inputer_d = inputer.split(" ") first_n = int(inputer_d[0]) second_n = int(inputer_d[1]) result=0 wa = int(first_n+second_n) seki = int(first_n*second_n) saidai_sho=0 saidai_sa =0 tmp=0 if wa > seki: saidai_sa= int(wa%seki) saidai_sho= seki while(saidai_sho%saidai_sa >0): tmp=int(saidai_sho%saidai_sa) saidai_sho=saidai_sa saidai_sa = tmp result =saidai_sa elif wa < seki: saidai_sa= seki-wa saidai_sho= wa while(saidai_sho%saidai_sa >0): tmp=int(saidai_sho%saidai_sa) saidai_sho=saidai_sa saidai_sa = tmp result =saidai_sa else: result=wa print(result)