#include<iostream>
using namespace std;
#define ll long long
int main()
{
    ll l,m,n;
    while(cin >>l)
    {
        if(l==0)break;
        int ans = 0;
        for(int i=1;i<13;i++)
        {
            cin >> m >> n;
            l -= (m-n);
            if(l<=0 && ans ==0)
            ans = i;
        }
        if(ans!=0)cout << ans << endl;
        else cout << "NA" <<endl;
    }
    return 0;
}