import std.stdio;
import std.algorithm;
import std.math;
import std.string;
import std.conv;
import std.range;

void main() {
    while (true) {
        int l = readln.chomp.to!int;
        if (l == 0) break;

        int[][] ary;
        for (int i = 0; i < 12; i++) {
            ary ~= readln.chomp.split.map!(to!int).array;
        }

        int sum = 0;
        int month = 0;
        foreach (int i, e; ary) {
            sum += e[0] - e[1];
            if (sum >= l) {
                month = i + 1;
                break;
            }
        }

        writeln(month == 0 ? "NA" : month.to!string);
    }
}