program probB
  implicit none
  integer*8 n,k,min,max,tmp,i,j,sw,rem
  integer*8 a(110000)
  

  read(*,*) k
  read(*,*) a(1:k)

  if(a(k).ne.2) then
     write(*,*) -1
     stop
  end if
  
  n=0
  min=0
  max=0
  sw=0
  rem=0
  do while(rem<3)
     n=n+1
     tmp=n
     do i=1,k
        if(tmp>=a(i))then
           tmp=tmp-mod(tmp,a(i))
        else
           tmp=0
           exit 
        end if
     end do
     if(tmp==2) then
        if(sw==0) min=n
        sw=1
        if(max<n) max=n
     end if
     rem=tmp
  end do

  if(min==0.or.max==0)then
     write(*,*) -1
  else
     write(*,*) min,max
  end if
  
   
end program probB
