using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; class Magatro { static void Main() { string[] ab = Console.ReadLine().Split(' '); Array.Sort(ab); long A = long.Parse(ab[0]); long B = long.Parse(ab[1]); Console.WriteLine(G(A,B )); } static long G(long a,long b) { long r = a % b; while (r != 0) { a = b; b = r; r = a % b; } return b; } }