implicit none

integer(8) :: ans_min=10000000000_8, ans_max=0, count=0
integer(8) :: k, i, j, n, n_org
integer,allocatable,dimension(:):: a

read(5,*) k
allocate(a(k))

read(5,*) (a(i),i=1,k)

n=maxval(a)-mod(maxval(a),a(1))


!write(6,*) n
do j=1,300
    n_org=n
    do i=1, k
        n=(int(n/a(i)))*a(i)
    enddo
    
    if (n==2) then
        ans_min=min(ans_min,n_org)
        ans_max=max(ans_max,n_org)
        count=1
    endif
n=n_org+a(1)

enddo

if (count==0)  then
    write(6,*), -1
else
    write(6,*) ans_min,ans_max+a(1)-1
endif 

stop
end