#include <cstdio>
#include <iostream>
#include <algorithm>
using namespace std;
int main(void){
  int l;
  while(cin >> l && l){
    int a=0;
    for(int i = 1; i <= 12; i++){
      int n,m;
      cin >> n >> m;
      if(!a) l -= n-m;
      if(!a && l <=0) a = i;
    }
    if(l > 0) cout << "NA" << endl;
    else cout << a << endl;
  }
}