#include <iostream>
#include <vector>
#include <algorithm>
#include <stack>
#include <string>
#include <map>
#include <functional>
#include <cmath>
#include <cstdio>
using namespace std;

int main(){
  unsigned long int L, N, M;
  while(cin >> L, L){
    int ans = 0;
    unsigned long int sum = 0;
    for(int i = 0; i < 12; i++){
      cin >> M >> N;
      sum += (M - N);
      if(sum >= L && !ans){
        ans = i + 1;
      }
    }
    if(sum < L)cout << "NA" << endl;
    else cout << ans << endl;
  }
}