You put an S after the N instead of a $, so it is taking all of those lines beginning there as integer values. You cannot compare a integer to a string, so therefore an error occurs at the first line where that happened. To fix this just change all of the NS's to N$.