using System;
using System.Numerics;
using System.Linq;

public class Test
{
	public static void Main()
	{
		var x = Console.ReadLine().Split(' ')
			.Select(n => BigInteger.Parse(n)).ToArray();
	
		var a = x[0] + x[1];
		var b = x[0] * x[1];
		
		Console.WriteLine(Gcd(a, b));
	}
	
	private static BigInteger Gcd(BigInteger a, BigInteger b)
	{
		if(a < b) return Gcd(b, a);
		
		while(b != 0)
		{
			var r = a % b;
			a = b;
			b = r;
		}
		return a;
	}
}