#include long long int gcd(long long int C, long long int D) { double tmp; double div1; long long int div2, r; div1 = C / D; div2 = div1; r = C % D; while (r != 0) { div1 /= r; div2 = div1; r = div2 % r; if (div2 == 0) { return 1; } } return div2; } int main(void) { long long int A, B; long long int a, b, ans; scanf("%lld", &A); scanf("%lld", &B); a = gcd(A + B, A); b = gcd(A + B, B); if (a*b >= A + B) { ans = gcd(a*b, A + B); } else { ans = gcd(A + B, a*b); } printf("%lld\n", ans); return 0; }