Have you heard about the myth that [if you fold a paper enough times, you can reach the moon with it](http://scienceblogs.com/startswithabang/2009/08/31/paper-folding-to-the-moon/)? Sure you have, but exactly how many? Maybe it's time to write a program to figure it out.

You know that a piece of paper has a thickness of `0.0001m`. Given `distance` in units of meters, calculate how many times you have to fold the paper to make the paper reach this distance.  
(If you're not familiar with the concept of folding a paper: Each fold doubles its total thickness.)

Note: Of course you can't do half a fold. You should know what this means ;P

Also, if somebody is giving you a negative distance, it's clearly bogus and you should yell at them by returning `null` (or whatever equivalent in your language. In Shell please return `None`).

Difficulty: EASY
Starter code: def fold_to(distance):
	

Solutions:
def fold_to(distance, thickness=0.0001, folds=0):
	if distance < 0:
		return
	while thickness < distance:
		thickness *= 2
		folds += 1
	return folds


import math

def fold_to(d):
	if d < 0:
		return None
	if d < 0.0001:
		return 0
	return math.ceil(math.log(d / 0.0001, 2))


def fold_to(distance):
	if distance < 0:
		return None
	i = 0
	while 0.0001 * 2 ** i < distance:
		i += 1
	return i


def fold_to(distance):
	if distance >= 0:
		return int(distance * 10000).bit_length()


def fold_to(distance):
	const = 0.0001
	if distance < 0:
		return None
	elif distance < const:
		return 0
	fold = 0
	while distance > const * 2 ** fold:
		fold += 1
	return fold


from math import ceil, log2

def fold_to(distance, thickness=0.0001):
	if distance >= 0:
		return distance >= thickness and ceil(log2(distance / thickness))


from math import log

def fold_to(d):
	if d == 0:
		return 0
	if d > 0:
		a = log(d / 0.0001) // log(2) + 1
		return max(a, 0)


def fold_to(distance):
	(fold, thickness) = (0, 0.0001)
	if distance < 0:
		return None
	while thickness <= distance:
		thickness *= 2
		fold += 1
	return fold


def fold_to(d):
	if d >= 0:
		return next((i for i in range(100) if 0.0001 * 2 ** i >= d))


def fold_to(distance):
	if distance >= 0:
		return next((i for i in __import__('itertools').count() if 0.0001 * 2 ** i >= distance))


from math import log, ceil

def fold_to(d):
	if d >= 0:
		return d and max(0, ceil(log(10000 * d, 2)))


from math import log2, ceil
from decimal import Decimal
paper_thickness_meters = Decimal('0.0001')

def fold_to(distance):
	if distance < 0:
		return None
	elif distance < paper_thickness_meters:
		return 0
	layers = Decimal(str(distance)) / paper_thickness_meters
	return ceil(log2(layers))


from math import log, ceil

def fold_to(distance, thickness=0.0001):
	return None if distance < 0 else 0 if distance <= thickness else ceil(log(distance / thickness, 2))


def fold_to(distance):
	thickness = 0.0001
	i = 0
	if distance > 0:
		while distance > thickness:
			thickness *= 2
			i += 1
		return i
	elif distance == 0:
		return 0
	else:
		return None


from math import log2, ceil

def fold_to(distance):
	return None if distance < 0 else ceil(log2(max(distance * 10000.0, 1)))


from math import log, ceil
fold_to = lambda d: None if d < 0 else 0 if d < 0.0001 else ceil(log(d * 10000, 2))


def fold_to(distance):
	print(distance)
	if distance == None:
		return 0
	if distance < 0:
		return None
	if distance == 0.0:
		return 0
	res = 0.0001
	folds = 0
	while res < distance:
		res *= 2
		folds += 1
	return folds


def fold_to(distance):
	folds = 0
	thickness = 0.0001
	total = 0
	if distance >= 0:
		while thickness < distance:
			thickness *= 2
			folds += 1
	else:
		return None
	return folds


import math

def fold_to(distance):
	if distance < 0:
		return None
	elif distance < 0.0001:
		return 0
	else:
		n = math.log(distance / 0.0001, 10) / math.log(2, 10) + 1
		return math.floor(n)


def fold_to(distance):
	position = 0.0001
	folds = 0
	while position < distance:
		position = position * 2
		folds += 1
	if distance < 0:
		return None
	else:
		return folds


fold_to = lambda distance: None if distance < 0 else 0 if distance == 0 or __import__('math').log(distance * 10000, 2) < 0 else int(__import__('math').log(distance * 10000, 2)) + 1


def fold_to(distance):
	paperThickness = 0.0001
	folds = 0
	if distance < 0:
		return None
	while paperThickness < distance:
		paperThickness *= 2
		folds += 1
	return folds


import unittest

def fold_to(distance):
	folding_count = 0
	meter_of_paper = 0.0001
	while meter_of_paper <= distance:
		folding_count += 1
		meter_of_paper = meter_of_paper * 2
	return folding_count if distance >= 0 else None

class TestFoldTo(unittest.TestCase):

	def test_fold_to_should_return_none_whne_given_distance_is_negative_one(self):
		distance = -1
		actual = fold_to(distance)
		self.assertEqual(actual, None)

	def test_fold_to(self):
		distance = 384000000
		actual = fold_to(distance)
		self.assertEqual(actual, 42)


def fold_to(distance):
	paper_thick = 0.0001
	folding = 0
	if distance < 0:
		return None
	elif distance == 0:
		return 0
	while distance > paper_thick:
		paper_thick = paper_thick * 2
		folding += 1
	return folding


def fold_to(distance):
	a = 0
	n = 0.0001
	if distance < 0:
		return None
	while n < distance:
		n *= 2
		a += 1
	return a


THICKNESS = 0.0001

def fold_to(distance):
	if distance < 0:
		return None
	current_thick = THICKNESS
	time = 0
	while current_thick < distance:
		current_thick += current_thick
		time += 1
	return time


def fold_to(distance):
	if distance < 0:
		return None
	length = 0.0001
	count = 0
	while length <= distance:
		length *= 2
		count += 1
	return count


import math

def fold_to(distance):
	return math.ceil(math.log2(distance / 0.0001)) if distance >= 0.0001 else None if distance < 0 else 0


def fold_to(distance):
	thicc = 0.0001
	counter = 0
	if distance >= 0:
		while thicc < distance:
			thicc = thicc * 2
			counter += 1
	else:
		counter = None
	return counter


def fold_to(distance):
	d = 0.0001
	c = 0
	if distance < 0:
		return None
	while d < distance:
		d = d * 2
		c += 1
	return c


import math

def fold_to(distance):
	if distance < 0:
		return None
	su = 0.0001
	fold = 0
	while su < distance:
		su *= 2
		fold += 1
	return fold


def fold_to(distance):
	if distance < 0:
		return
	i = 0
	l = 0.0001
	while l < distance:
		l = l * 2
		i = i + 1
	return i


import math

def fold_to(distance):
	thickness = 0.0001
	if distance == 0:
		return 0
	elif distance > 0:
		return max(math.ceil(math.log(distance, 2) - math.log(thickness, 2)), 0)
	else:
		return None


import math

def fold_to(distance):
	if distance < 0:
		return None
	if distance < 0.0001:
		return 0
	return int(math.ceil(math.log(distance / 0.0001, 2)))


def fold_to(distance):
	p = 0.0001
	if distance < 0:
		return None
	print(p)
	if p >= distance:
		return 0
	count = 0
	print(p)
	while p < distance:
		p += p
		count += 1
	return count


from math import log2

def fold_to(distance):
	if distance < 0:
		return None
	elif distance == 0:
		return 0
	return max(int(log2(distance / 0.0001)) + 1, 0)


def fold_to(distance):
	if distance >= 0:
		counter = 0
		t = 0.0001
		while t < distance:
			t *= 2
			counter += 1
		return counter


from math import log2, ceil

def fold_to(distance):
	if distance < 0:
		return None
	elif distance == 0:
		return 0
	return max(0, ceil(log2(distance * 10000)))


def fold_to(d):
	if d < 0:
		return None
	r = 0.0001
	x = 0
	while r < d:
		x += 1
		r *= 2
	return x


def fold_to(distance):
	if distance < 0:
		return None
	for i in range(0, 10000):
		if 2 ** i * 0.0001 >= distance:
			return i


import math

def fold_to(distance):
	if distance < 0:
		return None
	fold = math.ceil(math.log(distance / 0.0001, 2)) if distance else 0
	return fold if fold > 0 else 0


def fold_to(distance):
	epais = 0.0001
	compte = 0
	if distance < 0:
		return None
	else:
		while epais < distance:
			epais = epais * 2
			compte += 1
		return compte


def fold_to(distance):
	thick = 0.0001
	if distance < 0:
		return None
	elif thick > distance:
		return 0
	else:
		counter = 0
		while thick < distance:
			thick = thick * 2
			counter += 1
	return counter


def fold_to(distance):
	x = 0.0001
	count = 0
	if distance > x:
		while x < distance:
			x += x
			count += 1
		return count
	elif distance < 0:
		return None
	return 0


from math import log2, ceil

def fold_to(distance):
	if 0 > distance:
		return None
	if distance <= 0.0001:
		return 0
	return ceil(log2(10000 * distance))


def fold_to(distance):
	thickness = 0.0001
	folds = 0
	if distance < 0:
		return None
	elif distance < thickness:
		return 0
	else:
		while thickness < distance:
			thickness = thickness * 2
			folds = folds + 1
			if thickness >= distance:
				return int(folds)


def fold_to(distance):
	from math import log, ceil
	distance = float(distance)
	paper = 0.0001
	if distance >= paper:
		return ceil(log(distance / paper, 2))
	elif distance >= 0:
		return 0
	else:
		return None


from math import ceil, log2

def fold_to(distance):
	if distance < 0:
		return None
	if not distance:
		return 0
	return max(0, ceil(log2(distance / 0.0001)))


from math import *

def fold_to(d):
	if d < 0:
		return None
	elif floor(d * 10000) == 0:
		return 0
	else:
		return ceil(log(d * 10000, 2))


def fold_to(distance):
	p = 0.0001
	n = 0
	while p <= distance:
		p = p * 2
		n += 1
	if distance < 0:
		return None
	else:
		return n


def fold_to(distance):
	count = 0
	p_thickness = 0.0001
	if distance >= 0:
		while p_thickness < distance:
			p_thickness *= 2
			count += 1
		return count
	else:
		return None


def fold_to(B):
	if B < 0:
		return None
	B *= 10000
	L = 1
	M = 0
	while L < B:
		L *= 2
		M += 1
	return M


def fold_to(d, t=0.0001):
	if 0 <= d <= t:
		return 0
	elif d <= 0:
		return None
	c = 0
	while t < d:
		c += 1
		t *= 2
	return c


def fold_to(d):
	folds = 0
	t = 0.0001
	if d < 0:
		return None
	while t <= d:
		t = t * 2
		folds += 1
	return folds


def fold_to(distance):
	if distance >= 0:
		times = 0
		size = 0.0001
		while size < distance:
			size *= 2
			times += 1
		return times
	else:
		return None


from math import log2, ceil

def fold_to(d):
	return ceil(log2(d / 0.0001)) if d > 0.0001 else None if d < 0 else 0


def fold_to(distance):
	if distance < 0:
		return None
	res = 0
	l = 0.0001
	while l < distance:
		l *= 2
		res += 1
	return res