import java.util.*; import java.math.*; public class Main { private static Scanner sc = new Scanner(System.in); public static void main(String[] args) throws Exception { BigInteger a = new BigInteger(sc.next()); BigInteger b = new BigInteger(sc.next()); BigInteger s = a.add(b); BigInteger p = a.multiply(b); System.out.println(s.gcd(p).toString()); } }