Time Limit: 2 sec / Memory Limit: 1024 MB
配点 : 100 点
問題文
1 桁の数字が表示される画面と、ボタンからなる機械があります。
画面に数字 k が表示されているとき、ボタンを 1 回押すと画面の数字が a_k に変わります。
0 が表示されている状態からボタンを 3 回押すと、画面には何が表示されますか?
制約
- 0\leq a_i \leq 9
- 入力は全て整数である
入力
入力は以下の形式で標準入力から与えられる。
a_0 a_1 \dots a_9
出力
答えを出力せよ。
入力例 1
9 0 1 2 3 4 5 6 7 8
出力例 1
7
画面に表示される数字は、0 \rightarrow 9 \rightarrow 8 \rightarrow 7 と変化します。
入力例 2
4 8 8 8 0 8 8 8 8 8
出力例 2
4
画面に表示される数字は、0 \rightarrow 4 \rightarrow 0 \rightarrow 4 と変化します。
入力例 3
0 0 0 0 0 0 0 0 0 0
出力例 3
0
Score : 100 points
Problem Statement
There is a device with a screen that shows a single-digit number, and a button.
When the screen is showing a number k, pressing the button once changes the number on the screen to a_k.
The device currently shows 0. After pressing the button 3 times, what will be shown on the screen?
Constraints
- 0\leq a_i \leq 9
- All values in input are integers.
Input
Input is given from Standard Input in the following format:
a_0 a_1 \dots a_9
Output
Print the answer.
Sample Input 1
9 0 1 2 3 4 5 6 7 8
Sample Output 1
7
The number on the screen transitions as 0 \rightarrow 9 \rightarrow 8 \rightarrow 7.
Sample Input 2
4 8 8 8 0 8 8 8 8 8
Sample Output 2
4
The number on the screen transitions as 0 \rightarrow 4 \rightarrow 0 \rightarrow 4.
Sample Input 3
0 0 0 0 0 0 0 0 0 0
Sample Output 3
0