### main

while true
  l = gets.strip.to_i
  break if l == 0

  total = 0
  mon = nil

  for i in (1..12)
    m, n = gets.strip.split(' ').map{|s| s.to_i}

    total += m - n
    if mon.nil? && total >= l
      mon = i
    end
  end

  puts (mon.nil? ? 'NA' : mon)
end