프로그램 명: coci_volim
제한시간: 1 초

8명의 사람들이 아래 그림과 같이 원형으로 앉아서 폭탄 돌리기 게임을 한다. 맨 처음에는 K번 사람이 폭탄을 갖고 있다.

폭탄을 가진 사람은 퀴즈를 풀게 되는데 퀴즈를 맞힐 때에만 폭탄을 왼쪽 사람에게 넘겨줄 수 있다. 퀴즈를 틀리거나 스킵하게 되면 그 사람이 다음 문제를 풀어야 한다.

폭탄은 210초와 211초 사이에 터지게 된다. 이 때 폭탄이 터질 때 폭탄을 갖고 있던 사람을 구하여라. 단, 모든 퀴즈가 다 진행된 후에도 210초가 지나지 않았으면 가장 마지막에 폭탄을 가진 사람에게서 폭탄이 터지게 된다.

입력 형식

출력 형식

폭탄이 터질 때 폭탄을 갖고 있던 사람의 번호를 출력한다.

입출력 예

입력 예 1
출력 예 1
1
5
20 T
50 T
80 T
50 T
30 T
abcdef
입력 예 2
출력 예 2
3
5
100 T
100 N
100 T
100 T
100 N
4


입력 예 3
출력 예 3
5
6
70 T
50 P
30 N
50 T
30 P
80 T
7

Croatia's national television programme is broadcasting an entertainment show titled "I Love Croatia", modeled on the licensed format I love my country. In this show two teams of celebrities and public figures play various games which require knowledge about Croatia. One of the games is Happy Birthday, which will be used in this task, although somewhat altered.

Eight players numbered one through eight are seated in a circle (see picture). One of them is holding a box which will explode after 3 minutes and 30 seconds from the beginning of the game when some colorful confetti will be blown out. The game begins with a question to the player holding the box. If the players answers incorrectly or skips the question, he is immediately given the next question. If the player answers correctly, he passes the box to the first player seated on his left and then that player gets the next question.

You are given the numbered label of the player who has the box in the beginning and the outcomes of the first N questions asked. Determine the numbered label of the player who had the box when it finally exploded. The question outcome is described with the following data - time passed from the beginning of the question being asked to the moment an answer was given and whether the answer was true ("T"), false ("N") or skipped ("P"). The time between giving the answer and asking the next question shouldn't be taken into consideration, as well as time necessary for the box to be passed to the next player. The box will surely explode on a player's turn.

INPUT

OUTPUT

The first and only line of output must contain the numbered label of the player who had the box when it finally exploded.

SAMPLE TESTS

input 
 
1 
5 
20 T 
50 T 
80 T 
50 T 
30 T 
 
 
output 
 
5 

input 
 
3 
5 
100 T 
100 N 
100 T 
100 T 
100 N 
 
 
output 
 
4 

input 
 
5 
6 
70 T 
50 P 
30 N 
50 T 
30 P 
80 T 
 
output 
 
7 
출처:coci/2013-2014/contest2 1 번

[질/답] [제출 현황] [푼 후(0)]
[ 채 점 ] [홈으로]  [뒤 로]