K = int(eval(input()))

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



lo = 2

hi = 10**18





def check1(people):

    for a in A:

        people = (people // a) * a

    if people > 2:

        return False

    else:

        return True





def check2(people):

    for a in A:

        people = (people // a) * a

    if people < 2:

        return False

    else:

        return True





for i in range(100):

    center = (lo + hi) // 2

    if check1(center):

        lo = center

    else:

        hi = center



Mz = center



lo = 2

hi = 10**18



for i in range(100):

    center = (lo + hi) // 2

    if center > Mz:

        hi = center

        continue

    if check2(center):

        hi = center

    else:

        lo = center



mz = hi

if Mz >= mz:

    print((mz, Mz))

else:

    print((-1))
K = int(eval(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))

K = int(eval(input()))
A = list(map(int, input().split()))
lo = 2
hi = 10**18


def check1(people):
    for a in A:
        people = (people // a) * a
    if people > 2:
        return False
    else:
        return True


def check2(people):
    for a in A:
        people = (people // a) * a
    if people < 2:
        return False
    else:
        return True


for i in range(100):
    center = (lo + hi) // 2
    if check1(center):
        lo = center
    else:
        hi = center
Mz = center
lo = 2
hi = 10**18
for i in range(100):
    center = (lo + hi) // 2
    if center > Mz:
        hi = center
        continue
    if check2(center):
        hi = center
    else:
        lo = center
mz = hi
if Mz >= mz:
    print((mz, Mz))
else:
    print((-1))

K = int(eval(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))

-lo = 2 -hi = 10**18 - - -def check1(people): +# 最後に2人以上残るような最小のNを探す +ok, ng = 10**18, 0 +while abs(ok - ng) > 1: +    n = (ok + ng) // 2 +    x = n -        people = (people // a) * a -    if people > 2: -        return False +        x = (x // a) * a +    if x >= 2: +        ok = n -        return True - - -def check2(people): +        ng = n +m = ok +# 最後に2人以下になるような最大のNを探す +ok, ng = 0, 10**18 +while abs(ok - ng) > 1: +    x = (ok + ng) // 2 +    n = x -        people = (people // a) * a -    if people < 2: -        return False +        x = x // a * a +    if x <= 2: +        ok = n -        return True - - -for i in range(100): -    center = (lo + hi) // 2 -    if check1(center): -        lo = center -    else: -        hi = center -Mz = center -lo = 2 -hi = 10**18 -for i in range(100): -    center = (lo + hi) // 2 -    if center > Mz: -        hi = center -        continue -    if check2(center): -        hi = center -    else: -        lo = center -mz = hi -if Mz >= mz: -    print((mz, Mz)) +        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))