Digit Machine

AtCoder
IDabc241_a
Time2000ms
Memory256MB
Difficulty
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$ [samples]
Samples
Input #1
9 0 1 2 3 4 5 6 7 8
Output #1
7

The number on the screen transitions as $0 \rightarrow 9 \rightarrow 8 \rightarrow 7$.
Input #2
4 8 8 8 0 8 8 8 8 8
Output #2
4

The number on the screen transitions as $0 \rightarrow 4 \rightarrow 0 \rightarrow 4$.
Input #3
0 0 0 0 0 0 0 0 0 0
Output #3
0
API Response (JSON)
{
  "problem": {
    "name": "Digit Machine",
    "description": {
      "content": "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 ",
      "description_type": "Markdown"
    },
    "platform": "AtCoder",
    "limit": {
      "time_limit": 2000,
      "memory_limit": 262144
    },
    "difficulty": "None",
    "is_remote": true,
    "is_sync": true,
    "sync_url": null,
    "sign": "abc241_a"
  },
  "statements": [
    {
      "statement_type": "Markdown",
      "content": "There is a device with a screen that shows a single-digit number, and a button.\nWhen the screen is showing a number $k$, pressing the button once changes the number on the screen to $a_k$.\nThe device ...",
      "is_translate": false,
      "language": "English"
    }
  ]
}
Full JSON Raw Segments