Timothy (age: 16) really likes to smoke. Unfortunately, he is too young to buy his own cigarettes and that's why he has to be extremely efficient in smoking.

It's now your task to create a function that calculates how many cigarettes Timothy can smoke out of the given amounts of `bars` and `boxes`:

- a bar has 10 boxes of cigarettes,
- a box has 18 cigarettes,
- out of 5 stubs (cigarettes ends) Timothy is able to roll a new one,
- of course the self made cigarettes also have an end which can be used to create a new one...

Please note that Timothy never starts smoking cigarettes that aren't "full size" so the amount of smoked cigarettes is always an integer.

Source: codewars | Difficulty: EASY
Tags: Fundamentals

Starter code: def start_smoking(bars,boxes):
	

Solutions:
def start_smoking(bars, boxes):
	return int(22.5 * (10 * bars + boxes) - 0.5)


def start_smoking(bars, boxes):
	return ((10 * bars + boxes) * 90 - bool(bars + boxes)) // 4


def start_smoking(bars, boxes):
	total = bars * 10 * 18 + boxes * 18
	n = total
	while total >= 1:
		total /= 5
		n += total
	return int(n)


def start_smoking(bars, boxes):
	new = (bars * 10 + boxes) * 18
	smoked = ends = 0
	while new:
		smoked += new
		ends += new
		new = ends // 5
		ends -= new * 5
	return smoked


def start_smoking(bars, boxes):
	n = (bars * 10 + boxes) * 18
	count = 0
	while n > 4:
		(n, rest) = divmod(n, 5)
		count += n
		n += rest
	return (bars * 10 + boxes) * 18 + count


def start_smoking(bars, boxes):
	a = []
	x = 180 * bars + 18 * boxes
	a.append(x + x // 5)
	n = x % 5 + x // 5
	while n >= 5:
		a.append(n // 5)
		n = n % 5 + n // 5
	return sum(a)


(s, start_smoking) = (lambda n, r=0: n and n + s(*divmod(n + r, 5)), lambda B, b: s(18 * (10 * B + b)))


from math import log

def start_smoking(bars, boxes):
	n = (bars * 10 + boxes) * 18
	stubs = n
	while stubs > 4:
		n += stubs // 5
		stubs = sum(divmod(stubs, 5))
	return n


def start_smoking(bars, boxes):
	cigarettes = bars * 10 * 18 + boxes * 18
	smoked = 0
	leftovers = 0
	while True:
		smoked += cigarettes
		leftovers += cigarettes
		cigarettes = 0
		if leftovers >= 5:
			cigarettes += leftovers // 5
			leftovers = leftovers % 5
		else:
			return smoked


def start_smoking(bars, boxes):
	c = (bars * 10 + boxes) * 18
	r = 0
	stub = 0
	while c > 0:
		r += c
		stub += c
		(c, stub) = divmod(stub, 5)
	return r