cho.sh
Notes
Loading...

Chicken Coupons

Time limit

2s

Memory limit

128 MB

Problem

Kangmin has n coupons, each of which can be used to order one chicken. Whenever he orders one chicken with a coupon, the shop gives him one stamp. Every k stamps can be exchanged for one new coupon.

Determine the maximum number of chickens Kangmin can eat using the coupons he has now and any coupons he receives by exchanging stamps. A coupon is required to order each chicken.

Input

The input consists of multiple lines. Each line contains two natural numbers n and k separated by a space. Input continues until the end of file.

Output

For each input line, print the maximum number of chickens Kangmin can eat on its own line.

Constraints

  • 1 < k <= n <= 1,000,000,000