a,b = [int(i) for i in input().split()] wa = a+b seki = a*b if wa > seki: print("1") else: while seki % wa: seki,wa = wa, seki % wa print(str(wa))