P27795 [洛谷] Eating Ice Cream Bars
普及
题目描述

Problem Description

Doraemon loves eating ice cream bars.

When you buy an ice cream bar and finish eating it, you are left with a wooden stick. Every three wooden sticks can be exchanged for one ice cream bar. The ice cream bar obtained through exchange, when eaten, also leaves a wooden stick.

Therefore, if Doraemon buys 5 ice cream bars, he can get 5 wooden sticks after eating them. With 3 wooden sticks, he can exchange for 1 ice cream bar, leaving him with 2 wooden sticks. After eating the exchanged ice cream bar, he has 3 wooden sticks again, which can be exchanged for another ice cream bar. In the end, Doraemon actually eats 7 ice cream bars.

Doraemon wants to eat $n$ ice cream bars. How many ice cream bars does he need to buy initially to achieve this?

Input Format

A single line containing a positive integer, $n$.

Output Format

A single line containing a positive integer, representing the number of ice cream bars needed to be bought.

Sample Input and Output

Sample Input #1

7

Sample Output #1

5

Sample Input #2

20

Sample Output #2

14

Notes

Data Range and Constraints

For $100\%$ of the data, $1 \leq n \leq 100000000$.

输入格式

见题面 Input 部分

输出格式

见题面 Output 部分

样例输入
7
样例输出
5