using System; using System.Collections.Generic; using System.Linq; namespace yukicoder { public class Program { public static void Main() { var a = Console.ReadLine().Split(' ').Select(x => long.Parse(x)).ToArray(); var k = Euclid(a[0] , a[1]); if ((a[0] / k + a[1] / k) % 2 == 0) { k *= 2; } Console.WriteLine(k); } static long Euclid(long a, long b) { var c = Math.Max(a, b); var d = Math.Min(a, b); var e = c % d; if (e > 0) { return Euclid(e, d); } else { return d; } } } }