P8627 [Lanqiao Cup 2015 NOI Qualifier A] Beverage Exchange.

Description

Leyangyang Beverage Factory is holding a promotional event. For Leyangyang type C beverages, you can exchange $3$ bottle caps for one more type C beverage, and you can keep doing this in a loop (but borrowing or buying on credit is not allowed). Please calculate: if Xiaoming does not waste any bottle caps and participates in the event as much as possible, then for the $n$ bottles he initially buys, how many bottles of beverage can he drink in total in the end.

Input Format

An integer $n$, meaning the number of beverages bought at the beginning. ($0

Output Format

An integer, meaning the actual total number of beverages obtained.

Explanation/Hint

Problem H of Group A in the 2015 Lanqiao Cup provincial contest. Translated by ChatGPT 5