Adding tip to a restaurant bill in a graceful way can be tricky, thats why you need make a function for it.

The function will receive the restaurant bill (always a positive number) as an argument. You need to 1) **add at least 15%** in tip, 2) round that number up to an *elegant* value and 3) return it.

What is an *elegant* number? It depends on the magnitude of the number to be rounded. Numbers below 10 should simply be rounded to whole numbers. Numbers 10 and above should be rounded like this:

10 - 99.99... ---> Round to number divisible by 5

100 - 999.99... ---> Round to number divisible by 50

1000 - 9999.99... ---> Round to number divisible by 500

And so on...

Good luck!

## Examples
```
 1  -->    2
 7  -->    9
12  -->   15
86  -->  100
```

Source: codewars | Difficulty: EASY
Tags: Fundamentals

Mathematics

Starter code: def graceful_tipping(bill):
	

Solutions:
from math import ceil, log10

def graceful_tipping(bill):
	bill *= 1.15
	if bill < 10:
		return ceil(bill)
	e = int(log10(bill))
	unit = 10 ** e / 2
	return ceil(bill / unit) * unit


import math

def graceful_tipping(bill):
	c = bill * 115 / 100
	m = 1 if c < 10 else 5 * 10 ** int(math.log10(c) - 1)
	return math.ceil(c / m) * m


def graceful_tipping(bill):
	import math
	multiple = 0
	tip = bill + 0.15 * bill
	if tip < 10:
		multiple = 1
	elif tip < 100:
		multiple = 5
	elif tip < 1000:
		multiple = 50
	elif tip < 10000:
		multiple = 500
	elif tip < 100000:
		multiple = 5000
	elif tip < 1000000:
		multiple = 50000
	elif tip < 10000000:
		multiple = 500000
	elif tip < 100000000:
		multiple = 5000000
	return math.ceil(float(tip) / multiple) * multiple


import math

def graceful_tipping(bill):
	x = math.ceil(bill + bill * 15 / 100)
	if x < 11:
		return x
	else:
		le = len(str(x)) - 2
		y = 5 * 10 ** le
	return x + (y * math.ceil(x / y) - x)


import math

def graceful_tipping(rest_bill):
	res = rest_bill * 1.15
	if res < 10:
		return math.ceil(res)
	tmp = 5 * 10.0 ** (math.ceil(math.log10(res)) - 2)
	if res % tmp > 0:
		res += tmp - res % tmp
	return res


import math

def graceful_tipping(bill):
	bill = bill * 1.15
	if bill < 10:
		return math.ceil(bill)
	elif 10 <= bill < 100:
		bill = math.ceil(bill)
		mul5 = [i for i in range(1, bill + 5) if i % 5 == 0]
		return mul5[-1]
	elif 100 <= bill < 1000:
		bill = math.ceil(bill)
		mul50 = [i for i in range(1, bill + 50) if i % 50 == 0]
		return mul50[-1]
	elif 1000 <= bill < 10000:
		bill = math.ceil(bill)
		mul500 = [i for i in range(1, bill + 500) if i % 500 == 0]
		return mul500[-1]
	elif 10000 <= bill < 100000:
		bill = math.ceil(bill)
		mul5000 = [i for i in range(1, bill + 5000) if i % 5000 == 0]
		return mul5000[-1]
	elif 100000 <= bill < 1000000:
		bill = math.ceil(bill)
		mul50000 = [i for i in range(1, bill + 50000) if i % 50000 == 0]
		return mul50000[-1]
	elif 1000000 <= bill < 10000000:
		bill = math.ceil(bill)
		mul500000 = [i for i in range(1, bill + 500000) if i % 500000 == 0]
		return mul500000[-1]


def graceful_tipping(bill):
	total = bill * 1.15
	if total < 10:
		total = int(total) + (total % 1 > 0)
	else:
		x = len(str(int(total))) - 2
		m = 5 * 10 ** x
		total = (int(total / m) + (total % m > 0)) * m
	return total


from math import ceil

def graceful_tipping(bill):
	total = bill * 1.15
	if total < 10:
		return ceil(total)
	total /= 5
	d = 0
	while total >= 20:
		d += 1
		total /= 10
	return ceil(total) * 5 * 10 ** d


from math import ceil
from itertools import count

def graceful_tipping(bill):
	num = ceil(bill * 0.15 + bill)
	if num < 10:
		return num
	d = int('5' + (len(str(num)) - 2) * '0')
	for n in count(num):
		if n % d == 0:
			return n