n = int(eval(input()))

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



min = 2

max = 2

for i in reversed(a):

    max = max // i * i + i - 1

    min = (min + i - 1) // i * i



if min >= max:

    print("-1")

else:

    print((min, max))

n, *a = list(map(int, open(0).read().split()))



unko = 2

unti = 2

for i in reversed(a):

    unko = unko // i * i + i - 1

    unti = (unti + i - 1) // i * i

if unti >= unko:

    print((-1))

else:

    print((unti, unko))

n = int(eval(input()))
a = list(map(int, input().split()))
min = 2
max = 2
for i in reversed(a):
    max = max // i * i + i - 1
    min = (min + i - 1) // i * i
if min >= max:
    print("-1")
else:
    print((min, max))

n, *a = list(map(int, open(0).read().split()))
unko = 2
unti = 2
for i in reversed(a):
    unko = unko // i * i + i - 1
    unti = (unti + i - 1) // i * i
if unti >= unko:
    print((-1))
else:
    print((unti, unko))

-n = int(eval(input())) -a = list(map(int, input().split())) -min = 2 -max = 2 +n, *a = list(map(int, open(0).read().split())) +unko = 2 +unti = 2 -    max = max // i * i + i - 1 -    min = (min + i - 1) // i * i -if min >= max: -    print("-1") +    unko = unko // i * i + i - 1 +    unti = (unti + i - 1) // i * i +if unti >= unko: +    print((-1)) -    print((min, max)) +    print((unti, unko))