# Task
 When a candle finishes burning it leaves a leftover. makeNew leftovers can be combined to make a new candle, which, when burning down, will in turn leave another leftover.

 You have candlesNumber candles in your possession. What's the total number of candles you can burn, assuming that you create new candles as soon as you have enough leftovers?

# Example

 For candlesNumber = 5 and makeNew = 2, the output should be `9`.

 Here is what you can do to burn 9 candles:
```
burn 5 candles, obtain 5 leftovers;
create 2 more candles, using 4 leftovers (1 leftover remains);
burn 2 candles, end up with 3 leftovers;
create another candle using 2 leftovers (1 leftover remains);
burn the created candle, which gives another leftover (2 leftovers in total);
create a candle from the remaining leftovers;
burn the last candle.
Thus, you can burn 5 + 2 + 1 + 1 = 9 candles, which is the answer.
```

# Input/Output


 - `[input]` integer `candlesNumber`

    The number of candles you have in your possession.

    Constraints: 1 ≤ candlesNumber ≤ 50.
    

 - `[input]` integer `makeNew`

    The number of leftovers that you can use up to create a new candle.

    Constraints: 2 ≤ makeNew ≤ 5.
    

 - `[output]` an integer

Source: codewars | Difficulty: EASY
Tags: Ad-hoc

Starter code: def candles(m, n):
	

Solutions:
def candles(candles, make_new):
	return candles + (candles - 1) // (make_new - 1)


def candles(m, n):
	burn = leftover = 0
	while m:
		burn += m
		(m, leftover) = divmod(leftover + m, n)
	return burn


def candles(a, b):
	return a + (a - 1) // (b - 1)


from functools import lru_cache

@lru_cache(maxsize=None)
def candles(m, n, l=0):
	if not m and l < n:
		return 0
	(m, l) = (m + l // n, l % n)
	return m + candles(0, n, l + m)


def candles(m, n):
	(c, r) = (m, 0)
	while m:
		(m, r) = divmod(m + r, n)
		c += m
	return c


def candles(m, n):
	c = m
	while m >= n:
		(a, b) = divmod(m, n)
		c += a
		m = a + b
	return c


def candles(m, n):
	answer = 0
	(candles, leftovers) = (m, 0)
	while candles >= 1 or leftovers >= n:
		answer += candles
		leftovers += candles
		candles = leftovers // n
		leftovers -= leftovers // n * n
	return answer


def candles(candles1, leftovers):
	return candlesop(candles1, leftovers)

def candlesop(candles1, leftovers):
	candle1 = candles1
	answer = 0
	left = 0
	while candle1 != 0:
		answer += candle1
		left += candle1
		candle1 = left // leftovers
		left = left % leftovers
	return answer


def candles(m, n):
	total = 0
	l = 0
	while m:
		total += m
		(m, l) = divmod(m + l, n)
	return total


def candles(m, n):
	burnt = m
	leftovers = m
	while leftovers // n >= 1:
		burnt += leftovers // n
		leftovers = leftovers % n + leftovers // n
	return burnt