Author: | Антон Карабанов | Time limit: | 1 sec | |
Input file: | Standard input | Memory limit: | 256 Mb | |
Output file: | Standard output |
At the Research Institute where Timofey works, successful studies of a sequence of natural numbers are ongoing. Every day, his colleagues are discovering new properties of this sequence, and Timofey tries to keep up with them. This morning, as usual, the researchers formed a sequence of natural numbers. In the afternoon, following the head of the department's order, they repeatedly performed the following operation: remove from the sequence all numbers whose positions are divisible by 3, as well as the number at the first position.
The scientists performed n operations and became exhausted. What number now stands at the first position of the resulting sequence?
The only line of the input file contains a natural number n.
Output a single natural number — the answer to the problem.
1 ≤ n ≤ 100
For example, given n = 5, during each operation, all numbers whose positions are divisible by 3, as well as the first number in the sequence, will be removed. See the diagram. The resulting sequence will contain numbers such as 17, 26, 31, 40, 47, etc.
No. | Standard input | Standard output |
---|---|---|
1 |
|
|