In a game, an adult game master and N children play on an ice rink for K rounds. In each round, the game master announces to form groups of Ai children. Children form as many groups as possible, with one child in at most one group. Those without a group leave the game. After K rounds, exactly two children remain as winners. Given A1 to AK, find the smallest and largest possible N, or determine if no valid N exists. Constraints: 1 ≤ K ≤ 10^5, 2 ≤ Ai ≤ 10^9. Input format: K followed by A1 to AK. Output: Print the smallest and largest possible N, or -1 if the situation is impossible. Sample inputs and outputs are provided.

# Buggy version:
import math
K = int(input())
A = list(map(int, input().split()))
def check(init, A):
    cnt = init
    for a in A:
        group = cnt // a
        cnt = group * a
    return cnt

l,r = 2, 2**100
while r-l > 1:
    mid = (l+r)//2
    if check(mid, A) >= 2:
        r = mid
    else:
        l = mid
mincnt = r

l,r = 2, 2**100
while r-l > 1:
    mid = (l+r)//2
    if check(mid, A) <= 2:
        l = mid
    else:
        r = mid
maxcnt = l


if check(mincnt, A) == check(maxcnt, A) == 2:
    print(mincnt, maxcnt)
else:
    print(-1)



# Fixed version:
import math
K = int(input())
A = list(map(int, input().split()))
def check(init, A):
    cnt = init
    for a in A:
        group = cnt // a
        cnt = group * a
    return cnt

l,r = 0, 2**100
while r-l > 1:
    mid = (l+r)//2
    if check(mid, A) > 2:
        r = mid
    else:
        l = mid
maxcnt = l

l,r = 0, 2**100
while r-l > 1:
    mid = (l+r)//2
    if check(mid, A) < 2:
        l = mid
    else:
        r = mid
mincnt = r


if check(mincnt, A) == check(maxcnt, A) == 2:
    print(mincnt, maxcnt)
else:
    print(-1)

# Buggy version:
k = int(input())
a = list(map(int, input().split()))

def solve(num, checker):
    return checker*(num//checker)

left, right = 0, 10**9
while left < right:
    middle = (left+right)//2
    num = middle
    for i in a:
        num = solve(num, i)
    if num >= 2:
        right = middle
    else:
        left = middle + 1
x = right

left, right = 0, 10**9
while left < right:
    middle = (left+right)//2
    #print(left, right, middle, num)
    num = middle
    
    for i in a:
        num = solve(num, i)
    if num > 2:
        right = middle - 1
    else:
        left = middle + 1
y = left

if y < x:
    print(-1)
else:
    print(x, y)

# Fixed version:
k = int(input())
a = list(map(int, input().split()))

def solve(num, checker):
    return checker*(num//checker)

max_A = max(a)

left, right = 0, k*max_A + 1
while left < right:
    middle = (left+right)//2
    num = middle
    for i in a:
        num = solve(num, i)
    if num >= 2:
        right = middle
    else:
        left = middle + 1
x = right

left, right = 0, k*max_A + 1
while left < right:
    middle = -((-left-right)//2)
    #print(left, right, middle, num)
    num = middle
    
    for i in a:
        num = solve(num, i)
    if num <= 2:
        left = middle
    else:
        right = middle - 1
        
y = right

if y < x:
    print(-1)
else:
    print(x, y)

# Buggy version:
import math
K = int(input())
A = list(map(int,input().split()))
if A[0]!=2:
    print(-1)
elif K==1:
    print(2,3)
else:
    nmin = 2
    nmax = 2+A[K-1]-1
    flag = 0
    for i in range(K-2,-1,-1):
        b = A[i]
        nmin = math.ceil(nmin/b)*b
        nmax = math.floor(nmax/b)*b
        if nmin>nmax:
            flag = 1
            break
        nmax += b-1
    if flag==1:
        print(-1)
    else:
        print(nmin,nmax)

# Fixed version:
import math
K = int(input())
A = list(map(int,input().split()))
if A[K-1]!=2:
    print(-1)
elif K==1:
    print(2,3)
else:
    nmin = 2
    nmax = 2+A[K-1]-1
    flag = 0
    for i in range(K-2,-1,-1):
        b = A[i]
        nmin = math.ceil(nmin/b)*b
        nmax = math.floor(nmax/b)*b
        if nmin>nmax:
            flag = 1
            break
        nmax += b-1
    if flag==1:
        print(-1)
    else:
        print(nmin,nmax)

# Buggy version:
n=int(input())
a=list(map(int,input().split()))[::-1]
mn,mx=2,2
for j in a:
  mn=(mn+j-1)//j*j
  mx=mx//j*j+j-1
  if mx==0:
    print(-1)
    exit()
print(mn,mx)

# Fixed version:
n=int(input())
a=list(map(int,input().split()))[::-1]
if a[0]!=2:
  print(-1)
  exit()
mn,mx=2,2
for j in a:
  if (mn+j-1)//j>mx//j:
    print(-1)
    exit()
  mn=(mn+j-1)//j*j
  mx=mx//j*j+j-1
print(mn,mx)

# Buggy version:
import sys
import math
import collections
import bisect
import itertools

# import numpy as np

sys.setrecursionlimit(10 ** 7)
INF = 10 ** 16
MOD = 10 ** 9 + 7
# MOD = 998244353

ni = lambda: int(sys.stdin.readline().rstrip())
ns = lambda: map(int, sys.stdin.readline().rstrip().split())
na = lambda: list(map(int, sys.stdin.readline().rstrip().split()))
na1 = lambda: list(map(lambda x: int(x) - 1, sys.stdin.readline().rstrip().split()))


# ===CODE===

def main():
    k = ni()
    a = na()
    a.reverse()

    min_num = 2
    max_num = 2

    for ai in a:
        min_num = int(math.ceil(min_num / ai) * ai)
        max_num = int(math.floor(max_num / ai + 1) * ai) - 1

    print(min_num, max_num if min_num <= max_num else -1)


if __name__ == '__main__':
    main()


# Fixed version:
import sys
import math
import collections
import bisect
import itertools

# import numpy as np

sys.setrecursionlimit(10 ** 7)
INF = 10 ** 16
MOD = 10 ** 9 + 7
# MOD = 998244353

ni = lambda: int(sys.stdin.readline().rstrip())
ns = lambda: map(int, sys.stdin.readline().rstrip().split())
na = lambda: list(map(int, sys.stdin.readline().rstrip().split()))
na1 = lambda: list(map(lambda x: int(x) - 1, sys.stdin.readline().rstrip().split()))


# ===CODE===

def main():
    k = ni()
    a = na()
    a.reverse()

    min_num = 2
    max_num = 2

    for ai in a:
        min_num = int(math.ceil(min_num / ai) * ai)
        max_num = int(math.floor(max_num / ai + 1) * ai) - 1

    if min_num <= max_num:
        print(min_num, max_num)
    else:
        print(-1)


if __name__ == '__main__':
    main()

# Buggy version:
N = int(input())
A = list(map(int,input().split()))
A.reverse() #後ろから見る。

if A[0] != 2:
  print(-1)
  exit()
MIN = 2
MAX = 3
for i in range(1,N):
  nxt = A[i]
  if MAX < nxt:
    print(-1)
    exit() 
  #オッケーの最大値
  MAX = (MAX//nxt)*nxt #MAXは絶対前の数の倍数
  if MAX < MIN:
    print(-1)
    exit()
  #オッケーの最小値
  MIN = min(MAX,((MIN+nxt-1)//nxt)*nxt)

  print(MIN,MAX)
 
  #最小値は変化なし。
  MAX = MAX+(nxt-1)
  print(nxt,MIN,MAX)
print(MIN,MAX)


# Fixed version:
N = int(input())
A = list(map(int,input().split()))
A.reverse() #後ろから見る。

if A[0] != 2:
  print(-1)
  exit()
MIN = 2
MAX = 3
for i in range(1,N):
  nxt = A[i]
  if MAX < nxt:
    print(-1)
    exit() 
  #オッケーの最大値
  MAX = (MAX//nxt)*nxt #MAXは絶対前の数の倍数
  if MAX < MIN:
    print(-1)
    exit()
  #オッケーの最小値
  MIN = min(MAX,((MIN+nxt-1)//nxt)*nxt)

  #print(MIN,MAX)
 
  #最小値は変化なし。
  MAX = MAX+(nxt-1)
  #print(nxt,MIN,MAX)
print(MIN,MAX)

# Buggy version:
#AGC020-B Ice Rink Game
"""
逆操作を考える。
何人組を作るということは、modにおける最大値と最小値を求め続けるということ。
そのような組が作れないような場合(全員が脱落するような場合)は、-1を出力。
"""
import sys
readline = sys.stdin.buffer.readline
def even(n): return 1 if n%2==0 else 0

k = int(readline())
lst1 = list(map(int,readline().split()))
lst1.reverse()
if lst1[0] != 2:
    print(-1)
    exit()


def min_lot(value,unit):
    if value%unit == 0:
        return value//unit
    else:
        return value//unit + 1
mn = 2
mx = 3
for i in range(1,k):
    if not mn <= lst1[i] <= mx:
        print(-1)
        exit()
    res = min_lot(mn,lst1[i])
    mn = res*lst1[i]

    lim = (mx//lst1[i] + 1)*lst1[i] - 1
    mx = lim



print(mn,mx)

# Fixed version:
#AGC020-B Ice Rink Game
"""
逆操作を考える。
何人組を作るということは、modにおける最大値と最小値を求め続けるということ。
そのような組が作れないような場合(全員が脱落するような場合)は、-1を出力。
"""
import sys
readline = sys.stdin.buffer.readline
def even(n): return 1 if n%2==0 else 0

k = int(readline())
lst1 = list(map(int,readline().split()))
lst1.reverse()
if lst1[0] != 2:
    print(-1)
    exit()


def min_lot(value,unit):
    if value%unit == 0:
        return value//unit
    else:
        return value//unit + 1
mn = 2
mx = 3
for i in range(1,k):
    res = min_lot(mn,lst1[i])

    if not mn <= res*lst1[i] <= mx:
        print(-1)
        exit()

    mn = res*lst1[i]

    lim = (mx//lst1[i] + 1)*lst1[i] - 1
    mx = lim



print(mn,mx)

# Buggy version:
import sys
import math

sys.setrecursionlimit(10 ** 6)
INF = float("inf")
MOD = 10 ** 9 + 7


def input():
    return sys.stdin.readline().strip()


def main():
    K = int(input())
    A = list(map(int, input().split()))

    if A[-1] != 2:
        print(-1)
        return

    # ラウンドiにおける通過者を保存
    m = 2
    M = 2
    for i in range(K - 2, -1, -1):
        n = (m + A[i] - 1) // A[i]
        tmp_m = n * A[i]
        tmp_M = (n + 1) * A[i] - 1
        if tmp_m > M or tmp_M < m:
            print(-1)
            return
        m = tmp_m
        M = tmp_M

    print(m, M)


if __name__ == "__main__":
    main()


# Fixed version:
import sys
import math

sys.setrecursionlimit(10 ** 6)
INF = float("inf")
MOD = 10 ** 9 + 7


def input():
    return sys.stdin.readline().strip()


def main():
    K = int(input())
    A = list(map(int, input().split()))

    # ラウンドiにおける通過者を保存
    m = 2
    M = 2
    for i in range(K - 1, -1, -1):
        n = (m + A[i] - 1) // A[i]
        tmp_m = n * A[i]
        tmp_M = (M // A[i]) * A[i] + A[i] - 1
        if tmp_m > M or tmp_M < m:
            print(-1)
            return
        m = tmp_m
        M = tmp_M

    print(m, M)


if __name__ == "__main__":
    main()

# Buggy version:
k = int(input())
A = list(map(int, input().split()))
A.reverse()

L = [-1]*(k+1)
R = [-1]*(k+1)

L[0] = 2
R[0] = 2
for i in range(1, k+1):
    if L[i-1]%A[i-1] == 0 or R[i-1]%A[i-1] == 0:
        pass
    else:
        if R[i-1] - L[i-1] >= A[i-1] or L[i-1]%A[i-1]>R[i-1]%A[i-1]:
            pass
        else:
            print(-1)
            exit()
    if L[i-1]%A[i-1] == 0:
        L[i] = (L[i-1]//A[i-1])*A[i-1]
    else:
        L[i] = (L[i-1]//A[i-1]+1)*A[i-1]
    R[i] = (R[i-1]//A[i-1])*A[i-1]+A[i-1]-1

print(L)
print(R)
print(L[k], R[k])


# Fixed version:
k = int(input())
A = list(map(int, input().split()))
A.reverse()

L = [-1]*(k+1)
R = [-1]*(k+1)

L[0] = 2
R[0] = 2
for i in range(1, k+1):
    if L[i-1]%A[i-1] == 0 or R[i-1]%A[i-1] == 0:
        pass
    else:
        if R[i-1] - L[i-1] >= A[i-1] or L[i-1]%A[i-1]>R[i-1]%A[i-1]:
            pass
        else:
            #print(i, A[i-1], L[i-1], R[i-1])
            print(-1)
            exit()
    if L[i-1]%A[i-1] == 0:
        L[i] = (L[i-1]//A[i-1])*A[i-1]
    else:
        L[i] = (L[i-1]//A[i-1]+1)*A[i-1]
    R[i] = (R[i-1]//A[i-1])*A[i-1]+A[i-1]-1
    #print(i, L[i], R[i])

#print(L)
#print(R)
print(L[k], R[k])

# Buggy version:
def div_ceil(x, y): return (x + y - 1) // y

N = int(input())
*A, = map(int, input().split())
cand_min, cand_max = 2, 2
for a in reversed(A):
    if a > cand_max: print(-1); break
    cand_max = (cand_max // a) * a
    cand_min = div_ceil(cand_min, a) * a
    cand_max = cand_max + a - 1
else:
    cand_max = (cand_max // a) * a
    print(cand_min, cand_max)

# Fixed version:
def div_ceil(x, y): return (x + y - 1) // y

N = int(input())
*A, = map(int, input().split())
cand_min, cand_max = 2, 2
for a in reversed(A):
    if div_ceil(cand_min, a) * a > cand_max: print(-1); break
    cand_min = div_ceil(cand_min, a) * a
    cand_max = (cand_max // a) * a + a - 1
else:
    print(cand_min, cand_max)

# Buggy version:
n=int(input())
l=list(map(int,input().split()))
l.reverse()
m=[2,3]
if l[0]!=2:
    print(-1)
    exit()
for i in range(1,n):
    p=l[i]
    s=-(-m[0]//p)*p
    e=(m[1]//p)*p
    if not m[0]<=s<=m[1]:
        print(-1)
        exit()
    m=[s,e]
print(*m)

# Fixed version:
n=int(input())
l=list(map(int,input().split()))
l.reverse()
m=[2,3]
if l[0]!=2:
    print(-1)
    exit()
for i in range(1,n):
    p=l[i]
    s=-(-m[0]//p)*p
    e=(m[1]//p)*p+p-1
    if not m[0]<=s<=m[1]:
        print(-1)
        exit()
    m=[s,e]
print(*m)

# Buggy version:
# input = sys.stdin.readline
from bisect import *
from collections import *
from heapq import *
import copy
K=int(input())
A=list(map(int,input().split()))
if A[-1]!=2:
    print(-1)
    exit()

maX=2
miN=2
for i in range(K-1,-1,-1):
    if A[i]%miN>=2:
        print(-1)
        exit()

    if miN%A[i]==0:
        pass
    else:
        miN=(miN//A[i] +1) *A[i]

    if maX%A[i]==0:
        maX=(maX//A[i]) *A[i] + A[i]-1
    else:
        maX=(maX//A[i]) *A[i] + A[i]-1

print(miN,maX)


# Fixed version:
# input = sys.stdin.readline
from bisect import *
from collections import *
from heapq import *
import copy
K=int(input())
A=list(map(int,input().split()))
if A[-1]!=2:
    print(-1)
    exit()

maX=2
miN=2

for i in range(K-1,-1,-1):

    if A[i]//maX>=2:
        print(-1)
        exit()
    if A[i]//miN>=2:
        miN=A[i]
    else:
        if miN%A[i]==0:
            pass
        else:
            miN=(miN//A[i] +1) *A[i]
    maX=maX-maX%A[i] + A[i]-1

mmaX=maX
for i in range(K):
    mmaX-=mmaX%A[i]
if mmaX==2:
    print(miN,maX)
else:
    print(-1)

# Buggy version:
K=int(input())
A=list(map(int,input().split()))
A=A[::-1]
#print(A)

M=3
m=2
import math
for i in range(1,K):
    if m%A[i]==0:
        Lm=m
    else:
        Lm=m+A[i]
    
    if Lm<m or M<Lm:
        print(-1)
        exit()
    LM=(M//A[i])*A[i]+A[i]-1
    if LM<Lm:
        print(-1)
        exit()
    M=LM
    m=Lm
print(m,M)
    

# Fixed version:
K=int(input())
A=list(map(int,input().split()))
A=A[::-1]
#print(A)
if A[0]!=2:
    print(-1)
    exit()

M=3
m=2
import math
for i in range(1,K):
    if m%A[i]==0:
        Lm=m
    else:
        Lm=(m//A[i]+1)*A[i]
    #print(Lm)
    if Lm<m or M<Lm:
        print(-1)
        exit()
    LM=(M//A[i])*A[i]+A[i]-1
    if LM<Lm:
        print(-1)
        exit()
    M=LM
    m=Lm
print(m,M)

# Buggy version:
# AGC020B - Ice Rink Game
def main():
    K, *A = map(int, open(0).read().split())
    l, h = 2, 2  # low, high
    for i in A[::-1]:
        l = (l + i - 1) // i * i
        h = (h / i + 1) * i - 1
    if l > h:
        print(-1)
    else:
        print(l, h)


if __name__ == "__main__":
    main()

# Fixed version:
# AGC020B - Ice Rink Game
def main():
    K, *A = map(int, open(0).read().split())
    l, h = 2, 2  # low, high
    for i in A[::-1]:
        l += -l % i
        h += i - 1 - h % i
    if l > h:
        print(-1)
    else:
        print(l, h)


if __name__ == "__main__":
    main()

# Buggy version:
K=int(input())
A=list(map(int,input().split()))
l,h=2,2
for a in A[::-1]:
    if h<a or h//a==l//a:
        l=h=-1
        break
    else:
        l=-(-l//a)*a
    h=(h//a+1)*a-1
if l==h==-1:
    print(-1)
else:
    print(l,h)

# Fixed version:
K=int(input())
A=list(map(int,input().split()))
l,h=2,2
for a in A[::-1]:
    l=-(-l//a)*a
    h=(h//a+1)*a-1
    if l>h:
        l=h=-1
        break
if l==h==-1:
    print(-1)
else:
    print(l,h)

# Buggy version:
n=int(input())
da=list(map(int ,input().split()))
Min=2
Max=2
ju=True
for i in da[::-1]:
    mi=(Min+i-1)//i
    ma=Max//i
    if mi*i>Max or ma*i<Min:
        ju=False
        break
    Min=mi*i
    Max=ma*i+i-1
if ju:
    print(Max,Min)
else:
    print(-1)

# Fixed version:
n=int(input())
da=list(map(int ,input().split()))
Min=2
Max=2
ju=True
for i in da[::-1]:
    mi=(Min+i-1)//i
    ma=Max//i
    if mi*i>Max or ma*i<Min:
        ju=False
        break
    Min=mi*i
    Max=ma*i+i-1
if ju:
    print(Min,Max)
else:
    print(-1)

# Buggy version:
def L(l,a):
    return ((l-1)//a)*a+a

def R(r,a):
    return (r//a)*a+a-1
K = int(input())
x = list(map(int,input().split()))
l=2
r=2
for i in range(K):
    a = x.pop()
    l = L(l,a)
    r = R(r,a)
    if l > r:
        l = r = -1
        break

print(l,r)


# Fixed version:
def L(l,a):
    return ((l-1)//a)*a+a

def R(r,a):
    return (r//a)*a+a-1
K = int(input())
x = list(map(int,input().split()))
l=2
r=2
for i in range(K):
    a = x.pop()
    l = L(l,a)
    r = R(r,a)
    if l > r:
        l = r = -1
        print(l)
        exit()

print(l,r)

# Buggy version:
K = int(input())
A = list(map(int, input().split()))

# 最後に2人以上残るような最小のNを探す
ok, ng = 0, 10 ** 18
while abs(ok - ng) > 1:
    n = (ok + ng) // 2
    x = n
    for a in A:
        x = (x // a) * a
    if x >= 2:
        ok = n
    else:
        ng = n
m = ok

# 最後に2人以下になるような最大のNを探す
ok, ng = 0, 10 ** 18
while abs(ok - ng) > 1:
    x = (ok + ng) // 2
    n = x
    for a in A:
        x = x // a * a

    if x <= 2:
        ok = n
    else:
        ng = n
M = ok


# 条件を満たすかチェック
mx, Mx = m, M
for a in A:
    mx = (mx // a) * a
    Mx = (Mx // a) * a

if mx == 2 and Mx == 2:
    print(m, M)
else:
    print(-1)


# Fixed version:
K = int(input())
A = list(map(int, input().split()))

# 最後に2人以上残るような最小のNを探す
ok, ng = 10 ** 18, 0
while abs(ok - ng) > 1:
    n = (ok + ng) // 2
    x = n
    for a in A:
        x = (x // a) * a
    if x >= 2:
        ok = n
    else:
        ng = n
m = ok

# 最後に2人以下になるような最大のNを探す
ok, ng = 0, 10 ** 18
while abs(ok - ng) > 1:
    x = (ok + ng) // 2
    n = x
    for a in A:
        x = x // a * a

    if x <= 2:
        ok = n
    else:
        ng = n
M = ok


# 条件を満たすかチェック
mx, Mx = m, M
for a in A:
    mx = (mx // a) * a
    Mx = (Mx // a) * a

if mx == 2 and Mx == 2:
    print(m, M)
else:
    print(-1)

# Buggy version:
K = int( input())
A = list( map( int, input().split()))
nowm = 2
nowM = 2
ans = 0
for i in range(K-1,-1,-1):
    if nowM < A[i]:
        ans = -1
        break
    elif nowm <= A[i]:
        nowm = A[i]
        nowM = A[i]*2 - 1
    else:
        nowm = (nowm//A[i]+1)*A[i]
        nowM = (nowM//A[i]+1)*A[i] - 1
        if nowm > nowM:
            nowM = nowm + A[i] -1
    print(nowm, nowM)
if ans == -1:
    print( -1)
else:
    print("{} {}".format(nowm, nowM))


# Fixed version:
K = int( input())
A = list( map( int, input().split()))
nowm = 2
nowM = 2
ans = 0
for i in range(K-1,-1,-1):
    a = A[i]
    if nowm <= ((nowm+a-1)//a)*a and ((nowm+a-1)//a)*a <= nowM:
        nowm = ((nowm+a-1)//a)*a
        nowM = (nowM//a)*a + a - 1
    else:
        ans = -1
        break
    # if nowM < A[i]:
    #     ans = -1
    #     break
    # elif nowm <= A[i]:
    #     nowm = A[i]
    #     nowM = A[i]*2 - 1
    # else:
    #     M = nowM
    #     nowm = (nowm//A[i]+1)*A[i]
    #     if nowm > M:
    #         ans = -1
    #         break
    #     if (nowM//A[i]+1)*A[i] <= M:
    #         nowM = (nowM//A[i]+1)*A[i] - 1
    #         if nowM < nowm:
    #             nowM = nowm + A[i] - 1
    #     else:
    #         nowM = nowm + A[i] - 1
if ans == -1:
    print( -1)
else:
    print("{} {}".format(nowm, nowM))

# Buggy version:
# 後ろから順に考える
# 最後のA_Kは必ず2である必要がある
# A_Kの前には2~3人である必要がある
# ...

K = int(input())
As = list(map(int, input().split()))
As.reverse()

fail = False
if As[0] != 2:
    fail = True
else:
    mn = 2
    mx = 3
    for a in As[1:]:
        # 今 [mn, mx] = [4, 13], a = 3だとする
        # a人組をつくったあとにありうる数は3の倍数なので、ここでは6, 9, 12のみありうる
        if mn % a != 0:
            mn = (mn // a) * a + a
        if mx % a != 0:
            mx = (mx // a) * a
        if mn > mx:
            fail = True
            break

        # mxを修正
        mx = mx + (a - 1)
if fail:
    print(-1)
else:

# Fixed version:
# 後ろから順に考える
# 最後のA_Kは必ず2である必要がある
# A_Kの前には2~3人である必要がある
# ...

K = int(input())
As = list(map(int, input().split()))
As.reverse()

fail = False
if As[0] != 2:
    fail = True
else:
    mn = 2
    mx = 3
    for a in As[1:]:
        # 今 [mn, mx] = [4, 13], a = 3だとする
        # a人組をつくったあとにありうる数は3の倍数なので、ここでは6, 9, 12のみありうる
        if mn % a != 0:
            mn = (mn // a) * a + a
        if mx % a != 0:
            mx = (mx // a) * a
        if mn > mx:
            fail = True
            break

        # mxを修正
        mx = mx + (a - 1)
if fail:
    print(-1)
else:
    print(mn, mx)

# Buggy version:
k = int(input())
a = list(map(int,input().split()))
a = a[::-1]

c = 2 #min
d = 2 #max
res = 1 #判定

for i in range(k):
    if d > a[i]:
        res = -1
        break
    if i != k-1:
        if c % a[i] != 0 or d % a[i] != 0:
            res = -1
            break
        else:
            d = d + a[i] -1
            p = c%a[i+1]
            q = d%a[i+1]
            if p == 0:
                c2 = c
            else:
                c2 = c + a[i+1]-p
            d2 = d-q
            
            if c2 <= d2:
                c = c2
                d = d2
            else:
                res = -1
                break
    else:
        d = d + a[i] -1
            
        
    
    
if res == -1:
    print(-1)
else:
    print(str(c) + ' ' + str(d))

# Fixed version:
k = int(input())
a = list(map(int,input().split()))
a = a[::-1]

c = 2 #min
d = 2 #max
res = 1 #判定

for i in range(k):
    if d < a[i]:
        res = -1
        break
    if i != k-1:
        if c % a[i] != 0 or d % a[i] != 0:
            res = -1
            break
        else:
            d = d + a[i] -1
            p = c%a[i+1]
            q = d%a[i+1]
            if p == 0:
                c2 = c
            else:
                c2 = c + a[i+1]-p
            d2 = d-q
            
            if c2 <= d2:
                c = c2
                d = d2
            else:
                res = -1
                break
    else:
        d = d + a[i] -1
            
        
    
    
if res == -1:
    print(-1)
else:
    print(str(c) + ' ' + str(d))

# Buggy version:
def minandmax(bottom,up,mod): #bottom< n < upなるmodで割り切れるnの値の最大値と最小値を返す
    if bottom%mod == 0:
        mnm = bottom
    else:
        mnm = bottom + (mod-bottom%mod)
        if mnm > up:
            mnm = None
    if up%mod == 0:
        mxm = up
    else:
        mxm = up - up%mod
        if mxm < bottom:
            mxm = None
    ans = [mnm,mxm]
    return ans

k = int(input())
a = list(map(int,input().split()))
i = k-1
bottom = 2
up = 2

check = True
if a[-1] != 2:
    check = False
while i >= 1 and check:
    bottom = minandmax(bottom,up+a[i]-1,a[i-1])[0]
    up = minandmax(bottom,up+a[i]-1,a[i-1])[1]
    if bottom == None and up == None:
        check = False
    elif bottom == None:
        bottom = up
    elif up == None:
        up = bottom
    i += -1

if check:
    bottom = minandmax(bottom,bottom+a[0]-1,1)[0]
    up = minandmax(up,up+a[0]-1,1)[1]
    print(bottom,up)
else:
    print("-1")

# Fixed version:
def minandmax(bottom,up,mod): #bottom< n < upなるmodで割り切れるnの値の最大値と最小値を返す
    if bottom%mod == 0:
        mnm = bottom
    else:
        mnm = bottom + (mod-bottom%mod)
        if mnm > up:
            mnm = None
    if up%mod == 0:
        mxm = up
    else:
        mxm = up - up%mod
        if mxm < bottom:
            mxm = None
    ans = [mnm,mxm]
    return ans

k = int(input())
a = list(map(int,input().split()))
i = k-1
bottom = 2
up = 2

check = True
if a[-1] != 2:
    check = False
while i >= 1 and check:
    nbottom = minandmax(bottom,up+a[i]-1,a[i-1])[0]
    nup = minandmax(bottom,up+a[i]-1,a[i-1])[1]
    if nbottom == None and nup == None:
        check = False
    elif nbottom == None:
        nbottom = nup
    elif nup == None:
        nup = nbottom
    i += -1
    bottom = nbottom
    up = nup

if check:
    bottom = minandmax(bottom,bottom+a[0]-1,1)[0]
    up = minandmax(up,up+a[0]-1,1)[1]
    print(bottom,up)
else:
    print("-1")

# Buggy version:
from collections import defaultdict,deque
import sys,heapq,bisect,math,itertools,string,queue,datetime
sys.setrecursionlimit(10**8)
INF = float('inf')
mod = 10**9+7
def inpl(): return list(map(int, input().split()))
def inpls(): return list(input().split())

K = int(input())
aa = reversed(inpl())

MIN = MAX = 2
for a in aa:
    print(a,MIN,MAX)
    if MIN%a == 0 or MAX//a - MIN//a > 0:
        MIN = ((MIN-1)//a+1) *a
        MAX = MAX//a*a+a-1
    else:
        print(-1)
        sys.exit()

print(MIN,MAX)


# Fixed version:
from collections import defaultdict,deque
import sys,heapq,bisect,math,itertools,string,queue,datetime
sys.setrecursionlimit(10**8)
INF = float('inf')
mod = 10**9+7
def inpl(): return list(map(int, input().split()))
def inpls(): return list(input().split())

K = int(input())
aa = reversed(inpl())

MIN = MAX = 2
for a in aa:
    if MIN%a == 0 or MAX//a - MIN//a > 0:
        MIN = ((MIN-1)//a+1) *a
        MAX = MAX//a*a+a-1
    else:
        print(-1)
        sys.exit()

print(MIN,MAX)

# Buggy version:
N = int(input())
P = list(reversed(list(map(int, input().split()))))

s, t = 2, 2
for i in P:
    p = max((s + i - 1) // i, 1)
    q = t // i
    print(i)
    if q < p:
        print(-1)
        quit(0)
    s, t = p * i, q * i + i - 1

print(s, t)


# Fixed version:
N = int(input())
P = list(reversed(list(map(int, input().split()))))

s, t = 2, 2
for i in P:
    p = max((s + i - 1) // i, 1)
    q = t // i
    if q < p:
        print(-1)
        quit(0)
    s, t = p * i, q * i + i - 1

print(s, t)

# Buggy version:
K = int(input())
A = [int(i) for i in input().split()]
A.reverse()

min_A=2
max_A=3
cnt=True
if A[-1]!=2:
  print(-1)
  cnt=False
for i in range(1,K):
  a=(min_A+A[i]-1)//A[i]*A[i]
  b=max_A//A[i]*A[i]
  if a>b:
    print(-1)
    cnt=False
    break
  else:
    min_A=a
    max_A=b+A[i]-1

if cnt:
  print(min_A,max_A)


# Fixed version:
K = int(input())
A = [int(i) for i in input().split()]
A.reverse()

min_A=2
max_A=3
cnt=True
if A[0]!=2:
  print(-1)
  cnt=False
for i in range(1,K):
  a=(min_A+A[i]-1)//A[i]*A[i]
  b=max_A//A[i]*A[i]
  if a>b and cnt:
    print(-1)
    cnt=False
    break
  else:
    min_A=a
    max_A=b+A[i]-1

if cnt:
  print(min_A,max_A)

# Buggy version:
from math import floor,ceil
K = int(input())
A = [int(x) for x in input().split()]
A.reverse()
jmax, jmin = 2,2

for i in range(0,K):
    if jmin % A[i] != 0:
        if (jmin + (A[i] - (jmin % A[i]))) > jmin:
            print(-1)
            exit()

    jmin = ceil(jmin / A[i]) * A[i]
    jmax = floor(jmax / A[i]) * A[i] + A[i] -1

print(jmin, jmax)

#計算量はO(3K)すなわちO(K)

# Fixed version:
from math import floor,ceil
K = int(input())
A = [int(x) for x in input().split()]
A.reverse()
jmax, jmin = 2,2

for i in range(0,K):
    mmax,mmin = jmax,jmin
    if mmin % A[i] != 0:
        if (mmin + (A[i] - (mmin % A[i]))) > mmax:
            print(-1)
            exit()

    jmin = ceil(jmin / A[i]) * A[i]
    jmax = floor(jmax / A[i]) * A[i] + A[i] -1

print(jmin, jmax)

#計算量はO(3K)すなわちO(K)

# Buggy version:
from math import floor, ceil
k = int(input())
a = [int(i) for i in input().split()]
l,r = 2,2
for ai in a[::-1]:
    if l // ai >= 1 or r // ai >= 1:
        print(-1)
        exit()
    l = ceil(l/ai)*ai
    r = floor(r/ai) * ai + ai - 1
print(l,r)


# Fixed version:
from math import floor, ceil
k = int(input())
a = [int(i) for i in input().split()]
l,r = 2,2
for ai in a[::-1]:
    xi = ceil(l/ai)
    yi = floor(r/ai)
    if xi > yi:
        print(-1)
        exit()
    l = xi * ai
    r = yi * ai + ai - 1
print(l, r)

# Buggy version:
K=int(input())
A=input().split(' ')
min=2
max=2
flag=0
while K>0:
  K=K-1
  i=int(A[K])
  if max<i:
    print('-1')
    flag=1
    break
  else:
    min=min+i-(min%i)
    max=max+i-(max%i)-1
if flag==0:
  print('{0} {1}'.format(min,max))

# Fixed version:
K=int(input())
A=input().split(' ')
min=2
max=2
flag=0
while K>0:
  K=K-1
  i=int(A[K])
  if max<i:
    print('-1')
    flag=1
    break
  elif i<min:
    if min%i!=0:min=min+i-(min%i)
    else:min=min+(min%i)
    max=max+i-(max%i)-1
    if min>max:
      print('-1')
      flag=1
      break
  else:
    min=i
    max=max+i-(max%i)-1
if flag==0:
  print('{0} {1}'.format(min,max))

# Buggy version:
K = int(input())
AT = list(map(int,input().split()))

A=reversed(AT)
s = 2;b = 1;lis=[]
for i in A:
    ns = i
    if s > ns:
        ns +=(((s-ns)//i)*i)
        if s > ns:
            ns+i
    s = ns
sn = s
for i in AT:
    sn = sn-sn%i

if sn!=2:
    print(-1)
    exit()
b = 1
AT.reverse()
for i in AT:
    b=b-b%i
    nb = i
    if b > nb:
        nb +=(((b-nb)//i)*i)
        if b > nb:
            nb+i
    b= (nb+i-1)
print(s,b)


# Fixed version:
K = int(input())
AT = list(map(int,input().split()))

A=reversed(AT)
s = 2;b = 1;lis=[]
for i in A:
    ns = i
    if s > ns:
        ns +=(((s-ns)//i)*i)
        if s > ns:
            ns+=i
    s = ns
sn = s
for i in AT:
    sn = sn-sn%i

if sn!=2:
    print(-1)
    exit()
b = 1
AT.reverse()
for i in AT:
    b=b-b%i
    nb = i
    if b > nb:
        nb +=(((b-nb)//i)*i)
        if b > nb:
            nb+=i
    b= (nb+i-1)
print(s,b)

# Buggy version:
K = int(input())
A = list(map(int,input().split()))

if A[-1] != 2:
	print(-1)
	exit(0)

minval = 2
maxval = 3
for i in range(K-1,-1,-1):
	if maxval < A[i] or (minval > A[i] and ((maxval - (maxval % A[i]) < minval)):
		print(-1)
		exit(0)

	if minval > A[i]:
		if minval % A[i] != 0:
			minval = minval + (A[i] - (minval % A[i]))

		maxval = (maxval - (maxval % A[i]) + A[i] - 1)

	else:
		maxval = A[i] + (A[i] - 1)
		minval = A[i]
		

print(str(minval) + " " + str(maxval))


# Fixed version:
K = int(input())
A = list(map(int,input().split()))

if A[-1] != 2:
	print(-1)
	exit(0)

minval = 2
maxval = 3
for i in range(K-1,-1,-1):
	if maxval < A[i] or (minval > A[i] and ((maxval - (maxval % A[i]) < minval))):
		print(-1)
		exit(0)

	if minval > A[i]:
		if minval % A[i] != 0:
			minval = minval + (A[i] - (minval % A[i]))

		maxval = (maxval - (maxval % A[i]) + A[i] - 1)

	else:
		maxval = A[i] + (A[i] - 1)
		minval = A[i]
		

print(str(minval) + " " + str(maxval))