#include <cstdio>
using namespace std;

int main(void)
{
    int l;
    int m, n;
    
    while (1){
        scanf("%d", &l);
        if (l == 0) break;
        
        int money = 0;
        int ans = 0;
        bool flag = true;
        for (int i = 0; i < 12; i++){
            scanf("%d %d", &m, &n);
            money += (m - n);
            if ((l <= money) && (flag)) {
                ans = i + 1;
                flag = false;
            }
        }
        if (ans != 0){
            printf("%d\n", ans);
        }
        else {
            printf("NA\n");
        }
    }
    return (0);
}