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