#include<iostream>
using namespace std;

int main(){

  int n;

  while(cin >> n, n){
    int x,y,ans = 0,t = 0;

    for(int i=0;i<12;i++){
      cin >> x >> y;

      ans += (x - y);

      if(ans >= n && t == 0){
	cout << i+1 << endl;
	t = 1;
      }
    }

    if(t == 0) cout << "NA" << endl;
  }
}