import fractions a = input().split() print( fractions.gcd( int(a[0])+int(a[1]), int(a[0])*int(a[1]) ) )