Problem E. Erasing Numbers

Author:Антон Карабанов   Time limit:1 sec
Input file:Standard input   Memory limit:256 Mb
Output file:Standard output  

Statement

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?

Input format

The only line of the input file contains a natural number n.

Output format

Output a single natural number — the answer to the problem.

Constraints

1 ≤ n ≤ 100

Example explanation

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.

Sample tests

No. Standard input Standard output
1
5
17

0.093s 0.027s 15