UVa 10346 - Peter's Smokes

Summary
Peter has n cigarettes. He smokes them one by one keeping all the butts. Out of k > 1 butts he can roll a new cigarette.

How many cigarettes can Peter have?

Explanation
After each round of smokes, determine the number of cigarette butts. Perform integer division on the number of butts each round to determine the number of new cigarettes.

Gotchas
Don't lose track of any unused cigarette butts.

Implementations
"

Input
4 3 10 3 100 5

Output
5 14 124