import java.util.*; public class Main { public static void main (String[] args) { Scanner sc = new Scanner(System.in); long a = sc.nextLong(); long b = sc.nextLong(); long c = a + b; long ans = 1; for (long i = 2; i <= Math.sqrt(c); i++) { while (c % i == 0) { if (a % i == 0) { a /= i; ans *= i; } else if (b % i == 0) { b /= i; ans *= i; } c /= i; } } if (c > 1 && a % c == 0) { ans *= c; } else if (c > 1 && b % c == 0) { ans *= c; } System.out.println(ans); } }