using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace yuki_442 { class Program { static void Main(string[] args) { var t = scan; var x = t[0]; var y = t[1]; if (x == 1) { x = y + 1; } else if (y == 1) { y = x + 1; } while (y > x || x % y != 0) { if (y > x) { long k = y; y = x; x = k; } if (x % y != 0) x = x % y; } Console.WriteLine(y); } static long[] scan { get { return Array.ConvertAll(Console.ReadLine().Split(), long.Parse); } } } }