Problem 2—M*A*S*H


Corporal Klinger is a member of the 4077th. Mobile Army Surgical Hospital in the Korean War; and he will do just about anything to get out.  The U.S. Army has made an offer for a lottery that will select one lucky person to return to the USA for a recruiting tour.  Klinger needs your help getting out.


The lottery is run by lining up all the members of the unit at attention and eliminating members by having the members “count off:”  the first person in line shouts “1”.  The next person shouts “2”, and so forth, until one person shouts N where N is a number chosen by pulling cards off of the top of a deck. Every time N is reached, the person who shouted it falls out of the line, and counting begins again at 1 with the next person in line. Whenever the end of the line has been reached before a count has been completed, the first person in line shouts out the number just after the one shouted by the last person in line, and the count resumes.  When there is just one person left in the line, that person gets to go to the USA.


As the company clerk, Klinger knows what the cards in the deck will be.  He can also order the recruits to stand in any order he chooses, and he can place himself in any position he cares to.  Klinger's problem is that even with all this information, he still doesn't know where he should be to guarantee his return home.  Your program should solve this problem for him.


INPUT SPECIFICATION.  The input file will contain multiple test cases.  Each test case will consist of two lines.  The first line will consist of a decimal integer N inclusively between 1 and 100 followed by <EOLN>.  N represents the number of people in line.  The second line will contain N–1 integers inclusively between 1 and 100 corresponding to the cards in the deck in the order in which they will be called.  The numbers will be separated by exactly one space and the line will be terminated by <EOLN>.  0<EOLN> will follow the last test case in the file.  No extra spaces or <EOLN>'s will appear in the file.


OUTPUT SPECIFICATION.  The output cases should be processed in the order in which they appear in the input file.  For each case, print “Klinger should be in position #N.” where N is the correct answer.  Each line should be terminated by <EOLN>.  No extra <EOLN> should appear in the output file.