UVa 10346 - Peter's Smokes

10346 - Peter's Smokes

 * http://icpcres.ecs.baylor.edu/onlinejudge/index.php?option=com_onlinejudge&page=show_problem&problem=1287

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.

Input
4 3 10 3 100 5

Output
5 14 124