# -*- coding: utf-8 -*- """ No.442 和と積 https://yukicoder.me/problems/no/442 """ import sys from sys import stdin from math import gcd input = stdin.readline def main(args): A, B = map(int, input().split()) ans = gcd(A + B, A * B) print(ans) if __name__ == '__main__': main(sys.argv[1:])