#include <iostream>
using namespace std;

int main() {
    int goal;
    while(cin >> goal, goal) {
        bool flag = false;
        int stack = 0;
        for(int i = 0; i < 12; ++i) {
            int a, b;
            cin >> a >> b;
            stack += a - b;
            if(!flag && stack >= goal) {
                cout << i + 1 << endl;
                flag = true;
            }
        }
        if(!flag) cout << "NA" << endl;
    }
    return 0;
}