using System; using static System.Console; using System.Linq; using System.Collections.Generic; class Program { static int NN => int.Parse(ReadLine()); static long[] NList => ReadLine().Split().Select(long.Parse).ToArray(); public static void Main() { Solve(); } static void Solve() { var c = NList; if (c[0] > c[1]) (c[0], c[1]) = (c[1], c[0]); var gcd = GCD(c[0], c[1]); if (gcd == c[0]) { var x = c[1] / c[0]; WriteLine(c[0] * GCD(x + 1, c[0])); } else { WriteLine(gcd); } } static long GCD(long a, long b) { if (a < b) return GCD(b, a); if (a % b == 0) return b; return GCD(b, a % b); } }