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; HashMap pMap = new HashMap<>(); for (long i = 2; i <= Math.sqrt(a); i++) { while (a % i == 0) { if (pMap.containsKey(i)) { pMap.put(i, pMap.get(i) + 1); } else { pMap.put(i, 1); } a /= i; } } if (a != 1) { if (pMap.containsKey(a)) { pMap.put(a, pMap.get(a) + 1); } else { pMap.put(a, 1); } } for (long i = 2; i <= Math.sqrt(b); i++) { while (b % i == 0) { if (pMap.containsKey(i)) { pMap.put(i, pMap.get(i) + 1); } else { pMap.put(i, 1); } b /= i; } } if (b != 1) { if (pMap.containsKey(b)) { pMap.put(b, pMap.get(b) + 1); } else { pMap.put(b, 1); } } HashMap sMap = new HashMap<>(); for (long i = 2; i <= Math.sqrt(c); i++) { while (c % i == 0) { if (sMap.containsKey(i)) { sMap.put(i, sMap.get(i) + 1); } else { sMap.put(i, 1); } c /= i; } } if (c != 1) { if (sMap.containsKey(c)) { sMap.put(c, pMap.get(c) + 1); } else { sMap.put(c, 1); } } long ans = 1; for (Map.Entry entry : sMap.entrySet()) { long x = entry.getKey(); if (pMap.containsKey(x)) { ans *= (long)(Math.pow(x, Math.min(pMap.get(x), entry.getValue()))); } } System.out.println(ans); } }