import sys sys.setrecursionlimit(5*10**5) input = sys.stdin.readline from collections import defaultdict, deque, Counter from heapq import heappop, heappush from bisect import bisect_left, bisect_right from math import gcd class Era: def __init__(self, n): self.N = n self.l = [i for i in range(n+1)] for i in range(2,min(n,n//2+10)): if self.l[i] == i: for p in range(i+i,n+1,i): if self.l[p] == p: self.l[p] = i # 素数判定 def isprime(self,n): return self.l[n] == n # 素因数分解 def primes(self,n): ans = [] now = n while now != 1: if not ans: ans.append([self.l[now], 1]) else: if ans[-1][0] == self.l[now]: ans[-1][1] += 1 else: ans.append([self.l[now], 1]) now //= self.l[now] return ans # 約数列挙 def facts(self,n): pf = self.primes(n) ans = [1] for pn, cnt in pf: tmp = [pow(pn, i) for i in range(1, cnt+1)] m = len(ans) for num in tmp: for i in range(m): ans.append(ans[i]*num) return ans era = Era(202020) n = int(input()) ab = [] cs = [] for i in range(n): a,b= map(int,input().split()) c = a*b cs.append((c,i)) ab.append([a,b]) cs.sort() cs = cs[::-1] d = [10**10]*(202020) ans = 0 for ci, i in cs: ai,bi = ab[i] fs = era.facts(ai) tmp = 0 for num in fs: if d[num] == 10**10: continue tmp = max(tmp, bi*num//d[num]) for num in fs: d[num] = min(d[num], ai) ans = max(tmp, ans) print(ans)