#include <iostream>
#include <sstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <climits>
#include <cfloat>
using namespace std;

int main()
{
    for(;;){
        int l;
        cin >> l;
        if(l == 0)
            return 0;

        int ret = -1;
        for(int i=1; i<=12; ++i){
            int m, n;
            cin >> m >> n;
            l -= m;
            l += n;
            if(ret == -1 && l <= 0)
                ret = i;
        }

        if(ret == -1)
            cout << "NA" << endl;
        else
            cout << ret << endl;
    }
}