K=int(eval(input()))

A=list(map(int,input().split()))



def g(n):

    for a in A:

        n=n-n%a

    return n



a_max=max(A)

l=1

r=2+K*a_max

while r-l>1:

    m=(l+r)//2

    if g(m)>=2:

        r=m

    else:

        l=m

l0=r



l=1

r=2+K*a_max

while r-l>1:

    m=(l+r)//2

    if g(m)<=2:

        l=m

    else:

        r=m

r0=l



if l0>r0:

    print((-1))

else:

    print((l0,r0))
K=int(eval(input()))

A=list(map(int, input().split()))



mx=2

mn=2

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

    a = A[i]

    a_mn = ((mn+a-1)//a)*a

    a_mx = mx - mx%a

    if a_mn > a_mx:

        print((-1))

        exit()

    mn=a_mn

    mx=a_mx+a-1

print(("{} {}".format(mn,mx)))
K = int(eval(input()))
A = list(map(int, input().split()))


def g(n):
    for a in A:
        n = n - n % a
    return n


a_max = max(A)
l = 1
r = 2 + K * a_max
while r - l > 1:
    m = (l + r) // 2
    if g(m) >= 2:
        r = m
    else:
        l = m
l0 = r
l = 1
r = 2 + K * a_max
while r - l > 1:
    m = (l + r) // 2
    if g(m) <= 2:
        l = m
    else:
        r = m
r0 = l
if l0 > r0:
    print((-1))
else:
    print((l0, r0))

K = int(eval(input()))
A = list(map(int, input().split()))
mx = 2
mn = 2
for i in range(K - 1, -1, -1):
    a = A[i]
    a_mn = ((mn + a - 1) // a) * a
    a_mx = mx - mx % a
    if a_mn > a_mx:
        print((-1))
        exit()
    mn = a_mn
    mx = a_mx + a - 1
print(("{} {}".format(mn, mx)))

- - -def g(n): -    for a in A: -        n = n - n % a -    return n - - -a_max = max(A) -l = 1 -r = 2 + K * a_max -while r - l > 1: -    m = (l + r) // 2 -    if g(m) >= 2: -        r = m -    else: -        l = m -l0 = r -l = 1 -r = 2 + K * a_max -while r - l > 1: -    m = (l + r) // 2 -    if g(m) <= 2: -        l = m -    else: -        r = m -r0 = l -if l0 > r0: -    print((-1)) -else: -    print((l0, r0)) +mx = 2 +mn = 2 +for i in range(K - 1, -1, -1): +    a = A[i] +    a_mn = ((mn + a - 1) // a) * a +    a_mx = mx - mx % a +    if a_mn > a_mx: +        print((-1)) +        exit() +    mn = a_mn +    mx = a_mx + a - 1 +print(("{} {}".format(mn, mx)))