title: Why does my code throws a NON ZERO EXIT CODE runtime error while using Ruby language?
body: <p><a href="https://i.stack.imgur.com/oZiBM.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/oZiBM.png" alt="enter image description here"></a></p>
  
  <p>I am trying to solve a HackerEarth problem using Ruby</p>
  
  <p>The problem is provided in the following link:</p>
  
  <p><a href="https://www.hackerearth.com/problem/algorithm/find-product/" rel="nofollow noreferrer">https://www.hackerearth.com/problem/algorithm/find-product/</a></p>
  
  <p>My solution for the problem is here :</p>
  
  <pre><code>n = gets.chomp.to_i
  a = Array.new
  if n &lt;= 1000
    n.times do 
      a &lt;&lt; gets.chomp.to_i
    end
  end
  a.each { |m| print m.to_s + " " }
  print "\n"
  answer = 1
  a.each do |m|
    answer = ( answer * m ) % ( (10**9) + 7)
  end
  puts "#{answer}"
  </code></pre>
  
  <p>The code throws a Runtime Non zero exit code (NZEC).I am not able to understand the concept of NZEC and what particulary wrong I am doing in this code. Can someone pls help me to understand NZEC and find a work around for it.</p>