import math

n = int(eval(input()))

a = [int(i) for i in input().split()]

mi = 2

ma = 2

for b in a[::-1]:

  mi = math.ceil(mi/b)*b

  ma = math.ceil((ma+1)/b)*b-1

  if ma < b or mi > ma:

    print((-1))

    exit()

print((mi,ma))
from math import ceil as c

eval(input())

m=M=2

for b in map(int,input().split()[::-1]):

  m = c(m/b)*b

  M = c((M+1)/b)*b-1

  if m > M:

    print((-1))

    exit()

print((m,M))
import math

n = int(eval(input()))
a = [int(i) for i in input().split()]
mi = 2
ma = 2
for b in a[::-1]:
    mi = math.ceil(mi / b) * b
    ma = math.ceil((ma + 1) / b) * b - 1
    if ma < b or mi > ma:
        print((-1))
        exit()
print((mi, ma))

from math import ceil as c

eval(input())
m = M = 2
for b in map(int, input().split()[::-1]):
    m = c(m / b) * b
    M = c((M + 1) / b) * b - 1
    if m > M:
        print((-1))
        exit()
print((m, M))

-import math +from math import ceil as c -n = int(eval(input())) -a = [int(i) for i in input().split()] -mi = 2 -ma = 2 -for b in a[::-1]: -    mi = math.ceil(mi / b) * b -    ma = math.ceil((ma + 1) / b) * b - 1 -    if ma < b or mi > ma: +eval(input()) +m = M = 2 +for b in map(int, input().split()[::-1]): +    m = c(m / b) * b +    M = c((M + 1) / b) * b - 1 +    if m > M: -print((mi, ma)) +print((m, M))