P28162 [洛谷] Peter's Cigarettes
普及-
题目描述

Problem Background

Friendly Reminder: Smoking is harmful to health, please do not attempt to smoke!

Problem Description

Peter has $n$ cigarettes. Every time he finishes a cigarette, he saves the butt. With $k$ ($k>1$) butts, he can exchange for a new cigarette. How many cigarettes can Peter ultimately smoke?

Unlike some brain teasers, Peter cannot borrow butts from another dimension and return them after smoking.

Input Format

Each test case consists of a single line containing two integers $n, k$ ($1 < n, k \le 10^8$).

Output Format

For each test case, output a single line containing an integer representing the total number of cigarettes Peter can smoke.

Sample Input and Output

Sample Input #1

4 3

Sample Output #1

5

Sample Input #2

10 3

Sample Output #2

14

Notes

For $100\%$ of the data, $1 < n, k \le 10^8$.

输入格式

见题面 Input 部分

输出格式

见题面 Output 部分

样例输入
4 3
样例输出
5