100 atcoder#ABC167D. [ABC167D] Teleporter
[ABC167D] Teleporter
Score: points
Problem Statement
The Kingdom of Takahashi has towns, numbered through .
There is one teleporter in each town. The teleporter in Town sends you to Town .
Takahashi, the king, loves the positive integer . The selfish king wonders what town he will be in if he starts at Town and uses a teleporter exactly times from there.
Help the king by writing a program that answers this question.
Constraints
Input
Input is given from Standard Input in the following format:
Output
Print the integer representing the town the king will be in if he starts at Town and uses a teleporter exactly times from there.
4 5
3 2 4 1
4
If we start at Town and use the teleporter times, our travel will be as follows: .
6 727202214173249351
6 5 2 5 3 2
2