import java.io.*; import java.util.*; public class Main { public static void main(String[] args) throws Exception { Scanner sc = new Scanner(); long a = sc.nextLong(); long b = sc.nextLong(); long c = a + b; HashMap base = new HashMap<>(); for (long i = 2; i <= Math.sqrt(c); i++) { while (c % i == 0) { base.put(i, base.getOrDefault(i, 0) + 1); c /= i; } } if (c > 1) { base.put(c, base.getOrDefault(c, 0) + 1); } HashMap next = new HashMap<>(); for (long i = 2; i <= Math.sqrt(a); i++) { while (a % i == 0) { next.put(i, next.getOrDefault(i, 0) + 1); a /= i; } } if (a > 1) { next.put(a, next.getOrDefault(c, 0) + 1); } for (long i = 2; i <= Math.sqrt(b); i++) { while (b % i == 0) { next.put(i, next.getOrDefault(i, 0) + 1); b /= i; } } if (b > 1) { next.put(b, next.getOrDefault(c, 0) + 1); } long ans = 1; for (long x : base.keySet()) { int times = Math.min(base.get(x), next.getOrDefault(x, 0)); for (int i = 0; i < times; i++) { ans *= x; } } System.out.println(ans); } } class Scanner { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); StringTokenizer st = new StringTokenizer(""); public Scanner() throws Exception { } public int nextInt() throws Exception { return Integer.parseInt(next()); } public long nextLong() throws Exception { return Long.parseLong(next()); } public double nextDouble() throws Exception { return Double.parseDouble(next()); } public String next() throws Exception { while (!st.hasMoreTokens()) { st = new StringTokenizer(br.readLine()); } return st.nextToken(); } }