Mock CCC '19 Contest 2 J3 - Tudor Buys Some Tea

View as PDF

Submit solution


Points: 3 (partial)
Time limit: 1.0s
Memory limit: 1G

Problem type

Tudor, having made his own tea for far too long, has decided to go to a nearby tea shop to buy some tea.

As every respectable tea shop does, this specific tea shop offers a loyalty program. For every K cups of tea that Tudor buys at the shop, the shop will give him one free cup of tea.

Tudor wants to drink at least N cups of tea. How many cups of tea will he have to buy in order to achieve this goal?

Constraints

1 \le N, K \le 10^{18} - note that 32-bit integers may not be sufficient to solve this problem.

In tests worth 5 marks, N = K.

Input Specification

The input will consist of a single line containing two positive integers, N and K.

Output Specification

Output, on a single line, the minimum number of cups of tea Tudor needs to buy.

Sample Input

11 10

Sample Output

10

Sample Explanation

This tea shop is very traditional and gives a free cup of tea per 10 bought. If Tudor buys 10 cups of tea, he'll end up with 11, which is perfect.


Comments

There are no comments at the moment.