#!/usr/bin/env python # -*- coding: utf-8 -*- import math a, b = [int(i) for i in input().split()] print(math.gcd((a + b), (a * b)))