P1150 Peter's Cigarettes
Background
**Warm reminder: Smoking is harmful to your health; please do not attempt to smoke!**
Description
Peter has $n$ cigarettes. Each time he finishes a cigarette, he keeps the butt. $k$ ($k>1$) butts can be exchanged for one new cigarette. How many cigarettes can Peter smoke in total?
Unlike some brain teasers, Peter cannot borrow cigarette butts from another dimension and return them after smoking.
Input Format
Each test case consists of one line containing two integers $n, k$ ($1 < n, k \le 10^8$).
Output Format
For each test case, output one line containing one integer, the total number of cigarettes.
Explanation/Hint
For $100\%$ of the testdata, $1 < n, k \le 10^8$.
Translated by ChatGPT 5