Write a program which reads an integer n and draws a Koch curve based on recursive calles of depth n.

The Koch curve is well known as a kind of fractals.

You can draw a Koch curve in the following algorithm:

* Divide a given segment (p1, p2) into three equal segments.
* Replace the middle segment by the two sides of an equilateral triangle (s, u, t) of the same length as the segment.
* Repeat this procedure recursively for new segments (p1, s), (s, u), (u, t), (t, p2).

<image>

You should start (0, 0), (100, 0) as the first segment.

Notes

Constraints

* 0 ≤ n ≤ 6

Input

An integer n is given.

Output

Print each point (x, y) of the Koch curve. Print a point in a line. You should start the point(0, 0), which is the endpoint of the first segment and end with the point (100, 0), the other endpoint so that you can draw the Koch curve as an unbroken line. Each solution should be given as a decimal with an arbitrary number of fractional digits, and with an absolute error of at most 10-4.

Examples

Input

1


Output

0.00000000 0.00000000
33.33333333 0.00000000
50.00000000 28.86751346
66.66666667 0.00000000
100.00000000 0.00000000


Input

2


Output

0.00000000 0.00000000
11.11111111 0.00000000
16.66666667 9.62250449
22.22222222 0.00000000
33.33333333 0.00000000
38.88888889 9.62250449
33.33333333 19.24500897
44.44444444 19.24500897
50.00000000 28.86751346
55.55555556 19.24500897
66.66666667 19.24500897
61.11111111 9.62250449
66.66666667 0.00000000
77.77777778 0.00000000
83.33333333 9.62250449
88.88888889 0.00000000
100.00000000 0.00000000

Source: aizu | Difficulty: UNKNOWN_DIFFICULTY


Solutions:
import math

def koch(d, x1, y1, x2, y2):
	if d == 0:
		return
	xs = (2 * x1 + x2) / 3
	ys = (2 * y1 + y2) / 3
	xt = (x1 + 2 * x2) / 3
	yt = (y1 + 2 * y2) / 3
	xu = (xt - xs) * math.cos(math.pi / 3) - (yt - ys) * math.sin(math.pi / 3) + xs
	yu = (xt - xs) * math.sin(math.pi / 3) + (yt - ys) * math.cos(math.pi / 3) + ys
	koch(d - 1, x1, y1, xs, ys)
	print(xs, ys)
	koch(d - 1, xs, ys, xu, yu)
	print(xu, yu)
	koch(d - 1, xu, yu, xt, yt)
	print(xt, yt)
	koch(d - 1, xt, yt, x2, y2)
n = int(input())
print(0.0, 0.0)
koch(n, 0.0, 0.0, 100.0, 0.0)
print(100.0, 0.0)


n = int(input())
sin60 = 3 ** 0.5 / 2
cos60 = 1 / 2

def kach(d, A, B):
	if d == n:
		print('{0:.8f} {1:.8f}'.format(*B))
		return True
	(x0, y0) = A
	(x1, y1) = B
	dx = (x1 - x0) / 3
	dy = (y1 - y0) / 3
	sx = x0 + dx
	sy = y0 + dy
	tx = x0 + 2 * dx
	ty = y0 + 2 * dy
	ux = sx + (dx * cos60 - dy * sin60)
	uy = sy + (dx * sin60 + dy * cos60)
	(S, T, U) = ((sx, sy), (tx, ty), (ux, uy))
	d += 1
	(kach(d, A, S), kach(d, S, U), kach(d, U, T), kach(d, T, B))
start = (0.0, 0.0)
end = (100.0, 0.0)
print('{0:.8f} {1:.8f}'.format(*start))
kach(0, start, end)


import sys
input = sys.stdin.readline
import math
a = math.sqrt(3) * 0.5

def koch(d, p1, p2):
	if d == 0:
		return
	else:
		s = [(2 * p1[0] + p2[0]) / 3, (2 * p1[1] + p2[1]) / 3]
		t = [(p1[0] + 2 * p2[0]) / 3, (p1[1] + 2 * p2[1]) / 3]
		u = [(t[0] - s[0]) * 0.5 - (t[1] - s[1]) * a + s[0], (t[0] - s[0]) * a + (t[1] - s[1]) * 0.5 + s[1]]
		koch(d - 1, p1, s)
		print(s[0], s[1])
		koch(d - 1, s, u)
		print(u[0], u[1])
		koch(d - 1, u, t)
		print(t[0], t[1])
		koch(d - 1, t, p2)

def main():
	n = int(input())
	p1 = [0, 0]
	p2 = [100, 0]
	print(p1[0], p1[1])
	koch(n, p1, p2)
	print(p2[0], p2[1])
main()


import math

def koch(d, p1, p2):
	if d == 0:
		return
	sx = (2 * p1[0] + 1 * p2[0]) / 3
	sy = (2 * p1[1] + 1 * p2[1]) / 3
	s = (sx, sy)
	tx = (1 * p1[0] + 2 * p2[0]) / 3
	ty = (1 * p1[1] + 2 * p2[1]) / 3
	t = (tx, ty)
	rad = math.radians(60)
	ux = (t[0] - s[0]) * math.cos(rad) - (t[1] - s[1]) * math.sin(rad) + s[0]
	uy = (t[0] - s[0]) * math.sin(rad) + (t[1] - s[1]) * math.cos(rad) + s[1]
	u = (ux, uy)
	koch(d - 1, p1, s)
	print(s[0], s[1])
	koch(d - 1, s, u)
	print(u[0], u[1])
	koch(d - 1, u, t)
	print(t[0], t[1])
	koch(d - 1, t, p2)
d = int(input())
p1 = (0, 0)
p2 = (100, 0)
print(p1[0], p1[1])
koch(d, p1, p2)
print(p2[0], p2[1])


def koch(n, left, right):
	vector = [(right[0] - left[0]) / 3, (right[1] - left[1]) / 3]
	vector_up = [-vector[1] * 3 ** 0.5 / 2, vector[0] * 3 ** 0.5 / 2]
	point1 = [left[0] + vector[0], left[1] + vector[1]]
	point2 = [left[0] + 2 * vector[0], left[1] + 2 * vector[1]]
	middle = [left[0] + vector[0] * 3 / 2 + vector_up[0], left[1] + vector[1] * 3 / 2 + vector_up[1]]
	if n == 0:
		return [right]
	if n == 1:
		return [point1, middle, point2, right]
	return koch(n - 1, left, point1) + koch(n - 1, point1, middle) + koch(n - 1, middle, point2) + koch(n - 1, point2, right)
for point in [[0, 0]] + koch(int(input()), [0, 0], [100, 0]):
	print(*point)


import math

def koch(n, p1x, p1y, p2x, p2y):
	if n == 0:
		return
	sx = (2 * p1x + 1 * p2x) / 3
	sy = (2 * p1y + 1 * p2y) / 3
	tx = (1 * p1x + 2 * p2x) / 3
	ty = (1 * p1y + 2 * p2y) / 3
	theta = math.pi / 3
	ux = math.cos(theta) * (tx - sx) - math.sin(theta) * (ty - sy) + sx
	uy = math.sin(theta) * (tx - sx) + math.cos(theta) * (ty - sy) + sy
	koch(n - 1, p1x, p1y, sx, sy)
	print('{:.5f} {:.5f}'.format(sx, sy))
	koch(n - 1, sx, sy, ux, uy)
	print('{:.5f} {:.5f}'.format(ux, uy))
	koch(n - 1, ux, uy, tx, ty)
	print('{:.5f} {:.5f}'.format(tx, ty))
	koch(n - 1, tx, ty, p2x, p2y)
n = int(input())
(p1x, p1y) = (0.0, 0.0)
(p2x, p2y) = (100.0, 0.0)
print('{:.5f} {:.5f}'.format(p1x, p1y))
koch(n, p1x, p1y, p2x, p2y)
print('{:.5f} {:.5f}'.format(p2x, p2y))


def koch(n, p1, p2):
	if n == 0:
		return
	s_x = p1[0] * 2 / 3 + p2[0] * 1 / 3
	s_y = p1[1] * 2 / 3 + p2[1] * 1 / 3
	t_x = p1[0] * 1 / 3 + p2[0] * 2 / 3
	t_y = p1[1] * 1 / 3 + p2[1] * 2 / 3
	u_x = (t_x - s_x) * 1 / 2 - (t_y - s_y) * 3 ** 0.5 / 2 + s_x
	u_y = (t_x - s_x) * 3 ** 0.5 / 2 + (t_y - s_y) / 2 + s_y
	(s, t, u) = ((s_x, s_y), (t_x, t_y), (u_x, u_y))
	koch(n - 1, p1, s)
	print(' '.join((str(i) for i in s)))
	koch(n - 1, s, u)
	print(' '.join((str(i) for i in u)))
	koch(n - 1, u, t)
	print(' '.join((str(i) for i in t)))
	koch(n - 1, t, p2)
(S, G) = ((0, 0), (100, 0))
print(' '.join((str(i) for i in S)))
koch(int(input()), S, G)
print(' '.join((str(i) for i in G)))


import math
n = int(input())
a = [0] * 2
b = [0] * 2
a[0] = 0
b[0] = 100

def koch(n, a, b):
	if n == 0:
		return
	s = [0] * 2
	t = [0] * 2
	u = [0] * 2
	s[0] = (2.0 * a[0] + 1.0 * b[0]) / 3.0
	s[1] = (2.0 * a[1] + 1.0 * b[1]) / 3.0
	t[0] = (1.0 * a[0] + 2.0 * b[0]) / 3.0
	t[1] = (1.0 * a[1] + 2.0 * b[1]) / 3.0
	u[0] = (t[0] - s[0]) * math.cos(math.pi / 3) - (t[1] - s[1]) * math.sin(math.pi / 3) + s[0]
	u[1] = (t[0] - s[0]) * math.sin(math.pi / 3) + (t[1] - s[1]) * math.cos(math.pi / 3) + s[1]
	koch(n - 1, a, s)
	print(s[0], s[1])
	koch(n - 1, s, u)
	print(u[0], u[1])
	koch(n - 1, u, t)
	print(t[0], t[1])
	koch(n - 1, t, b)
print(a[0], a[1])
koch(n, a, b)
print(b[0], b[1])


from math import sqrt

def func(N, p1, p2):
	if N == 0:
		return 0
	s = ((2 * p1[0] + p2[0]) / 3, (2 * p1[1] + p2[1]) / 3)
	t = ((p1[0] + 2 * p2[0]) / 3, (p1[1] + 2 * p2[1]) / 3)
	x = (t[0] - s[0]) / 2 - sqrt(3) * (t[1] - s[1]) / 2 + s[0]
	y = sqrt(3) * (t[0] - s[0]) / 2 + (t[1] - s[1]) / 2 + s[1]
	u = (x, y)
	func(N - 1, p1, s)
	print(*s)
	func(N - 1, s, u)
	print(*u)
	func(N - 1, u, t)
	print(*t)
	func(N - 1, t, p2)
N = int(input())
print(*(0.0, 0.0))
func(N, (0.0, 0.0), (100.0, 0.0))
print(*(100.0, 0.0))


import math

def plot(x, y):
	print(f'{x:.8f} {y:.8f}')

def koch(n, x1, y1, x2, y2):
	if n == 0:
		plot(x1, y1)
		return
	ax = (2 * x1 + x2) / 3
	ay = (2 * y1 + y2) / 3
	bx = (x1 + 2 * x2) / 3
	by = (y1 + 2 * y2) / 3
	cx = (bx - ax) * (1 / 2) - (by - ay) * (math.sqrt(3) / 2) + ax
	cy = (bx - ax) * (math.sqrt(3) / 2) + (by - ay) * (1 / 2) + ay
	koch(n - 1, x1, y1, ax, ay)
	koch(n - 1, ax, ay, cx, cy)
	koch(n - 1, cx, cy, bx, by)
	koch(n - 1, bx, by, x2, y2)
n = int(input())
koch(n, 0, 0, 100, 0)
plot(100, 0)


import math
n = int(input())
A = []

def koch(d, p1, p2):
	rot = math.radians(60)
	if d == 0:
		return 0
	else:
		s = ((2.0 * p1[0] + p2[0]) / 3.0, (2.0 * p1[1] + p2[1]) / 3.0)
		t = ((2.0 * p2[0] + p1[0]) / 3.0, (2.0 * p2[1] + p1[1]) / 3.0)
		ux = (t[0] - s[0]) * math.cos(rot) - (t[1] - s[1]) * math.sin(rot) + s[0]
		uy = (t[0] - s[0]) * math.sin(rot) + (t[1] - s[1]) * math.cos(rot) + s[1]
		u = (ux, uy)
		koch(d - 1, p1, s)
		print(s[0], s[1])
		koch(d - 1, s, u)
		print(u[0], u[1])
		koch(d - 1, u, t)
		print(t[0], t[1])
		koch(d - 1, t, p2)
p1 = (0.0, 0.0)
p2 = (100.0, 0.0)
print(p1[0], p1[1])
koch(n, p1, p2)
print(p2[0], p2[1])


def koch_curve(points, n):
	if n == 0:
		return points
	result = []
	for i in range(len(points) - 1):
		x = points[i + 1][0] - points[i][0]
		y = points[i + 1][1] - points[i][1]
		s = [points[i][0] + x / 3, points[i][1] + y / 3]
		t = [points[i][0] + 2 * x / 3, points[i][1] + 2 * y / 3]
		u_x = t[0] / 2 - t[1] * (3 ** 0.5 / 2) + s[0] / 2 + 3 ** 0.5 * s[1] / 2
		u_y = t[0] * 3 ** 0.5 / 2 + t[1] / 2 + s[1] / 2 - 3 ** 0.5 * s[0] / 2
		u = [u_x, u_y]
		result.extend([points[i], s, u, t])
	result.append(points.pop())
	return koch_curve(result, n - 1)
n = int(input())
for point in koch_curve([[0.0, 0.0], [100.0, 0.0]], n):
	print(*map(str, point))


n = int(input())

def drawKoch(p1, p2, i):
	if i == 0:
		print(*p1)
		return 0
	else:
		s = [p2[0] / 3 + p1[0] * 2 / 3, p2[1] / 3 + p1[1] * 2 / 3]
		t = [p2[0] * 2 / 3 + p1[0] / 3, p2[1] * 2 / 3 + p1[1] / 3]
		u = [p2[0] / 2 + p1[0] / 2 - (p2[1] - p1[1]) / (2 * 3 ** 0.5), p2[1] / 2 + p1[1] / 2 + (p2[0] - p1[0]) / (2 * 3 ** 0.5)]
		drawKoch(p1, s, i - 1)
		drawKoch(s, u, i - 1)
		drawKoch(u, t, i - 1)
		drawKoch(t, p2, i - 1)
p1_start = [0.0, 0.0]
p2_start = [100.0, 0.0]
drawKoch(p1_start, p2_start, n)
print(*p2_start)


from math import sqrt

def koch(n, c1, c2):
	if n == 0:
		return
	v = [c2[0] - c1[0], c2[1] - c1[1]]
	s = [c1[0] + v[0] / 3, c1[1] + v[1] / 3]
	t = [c1[0] + 2 * v[0] / 3, c1[1] + 2 * v[1] / 3]
	u = [c1[0] + v[0] / 2 - v[1] * sqrt(3) / 6, c1[1] + v[1] / 2 + v[0] * sqrt(3) / 6]
	koch(n - 1, c1, s)
	print(' '.join(map(str, s)))
	koch(n - 1, s, u)
	print(' '.join(map(str, u)))
	koch(n - 1, u, t)
	print(' '.join(map(str, t)))
	koch(n - 1, t, c2)

def main():
	fmt = '%.8f %.8f'
	q3 = sqrt(3)
	c1 = [0, 0]
	c2 = [100, 0]
	n = int(input())
	print(fmt % tuple(c1))
	koch(n, c1, c2)
	print(fmt % tuple(c2))
main()


import math

def rot60(s, t):
	v = t - s
	a = 1 / 2 + complex(0, math.sqrt(3) / 2)
	return v * a + s

def pr(p):
	x = p.real
	y = p.imag
	print('%.10f %.10f' % (x, y))

def dfs(p1, p2, n):
	if n == 0:
		return
	s = (p2 - p1) * (1 / 3) + p1
	t = (p2 - p1) * (2 / 3) + p1
	u = rot60(s, t)
	dfs(p1, s, n - 1)
	pr(s)
	dfs(s, u, n - 1)
	pr(u)
	dfs(u, t, n - 1)
	pr(t)
	dfs(t, p2, n - 1)
n = int(input())
s = 0 + 0j
t = 100 + 0j
pr(s)
dfs(s, t, n)
pr(t)


import cmath

def f():
	global d
	p = []
	for i in range(len(d) - 1):
		(a, b) = (d[i], d[i + 1])
		r = (b - a) / 3
		p += [a, a + r, a + r + r * cmath.rect(1, cmath.pi / 3), b - r]
	d = p + [d[-1]]
d = [0j, 100 + 0j]
for _ in [0] * int(input()):
	f()
for e in d:
	print(e.real, e.imag)


import math

def plot(x, y):
	print(f'{x:.8f} {y:.8f}')

def Koch(n, x1, y1, x2, y2):
	if n == 0:
		plot(x1, y1)
		return
	sx = (2 * x1 + 1 * x2) / 3
	sy = (2 * y1 + 1 * y2) / 3
	tx = (1 * x1 + 2 * x2) / 3
	ty = (1 * y1 + 2 * y2) / 3
	ux = (tx - sx) * (1 / 2) - (ty - sy) * (math.sqrt(3) / 2) + sx
	uy = (tx - sx) * (math.sqrt(3) / 2) + (ty - sy) * (1 / 2) + sy
	Koch(n - 1, x1, y1, sx, sy)
	Koch(n - 1, sx, sy, ux, uy)
	Koch(n - 1, ux, uy, tx, ty)
	Koch(n - 1, tx, ty, x2, y2)
n = int(input())
Koch(n, 0, 0, 100, 0)
plot(100, 0)


import math
INFTY = 100000000
n = int(input())

def kock(p1, p2, n):
	s = [(p1[0] * 2 + p2[0]) / 3, (p1[1] * 2 + p2[1]) / 3]
	t = [(p1[0] + p2[0] * 2) / 3, (p1[1] + p2[1] * 2) / 3]
	u = [(t[0] - s[0]) / 2 - (t[1] - s[1]) / 2 * math.sqrt(3) + s[0], (t[0] - s[0]) / 2 * math.sqrt(3) + (t[1] - s[1]) / 2 + s[1]]
	if n == 0:
		print('%.8f %.8f' % (p1[0], p1[1]))
	else:
		kock(p1, s, n - 1)
		kock(s, u, n - 1)
		kock(u, t, n - 1)
		kock(t, p2, n - 1)
start = [0.0, 0.0]
end = [100.0, 0.0]
if n == 0:
	print('%.8f %.8f' % (start[0], start[1]))
	print('%.8f %.8f' % (end[0], end[1]))
else:
	kock(start, end, n)
	print('%.8f %.8f' % (end[0], end[1]))


import math
import copy

def koch(x1, y1, x2, y2):
	(x3, y3) = ((x1 * 2 + x2) / 3, (y1 * 2 + y2) / 3)
	(x4, y4) = ((x1 + x2 * 2) / 3, (y1 + y2 * 2) / 3)
	(x5, y5) = (x3 + (x4 - x3) / 2 - (y4 - y3) * math.sqrt(3) / 2, y3 + (x4 - x3) * math.sqrt(3) / 2 + (y4 - y3) / 2)
	return (x3, y3, x4, y4, x5, y5)
n = int(input())
a = [[0, 0], [100, 0]]
b = copy.copy(a)
for _ in range(n):
	b = copy.copy(a)
	for i in range(len(b) - 1):
		(x3, y3, x4, y4, x5, y5) = koch(b[i][0], b[i][1], b[i + 1][0], b[i + 1][1])
		a.insert(4 * i + 1, [x3, y3])
		a.insert(4 * i + 2, [x5, y5])
		a.insert(4 * i + 3, [x4, y4])
for i in a:
	i = list(map(str, i))
	print(' '.join(i))


import sys
input = sys.stdin.readline
import math
cos60 = math.cos(math.radians(60))
sin60 = math.sin(math.radians(60))
n = int(input())

def koch(d, p, q):
	if d == 0:
		return
	s = [0, 0]
	t = [0, 0]
	u = [0, 0]
	s[0] = (2 * p[0] + q[0]) / 3
	s[1] = (2 * p[1] + q[1]) / 3
	t[0] = (p[0] + 2 * q[0]) / 3
	t[1] = (p[1] + 2 * q[1]) / 3
	u[0] = (t[0] - s[0]) * cos60 - (t[1] - s[1]) * sin60 + s[0]
	u[1] = (t[0] - s[0]) * sin60 + (t[1] - s[1]) * cos60 + s[1]
	koch(d - 1, p, s)
	print(s[0], s[1])
	koch(d - 1, s, u)
	print(u[0], u[1])
	koch(d - 1, u, t)
	print(t[0], t[1])
	koch(d - 1, t, q)
a = [0, 0]
b = [100, 0]
print(a[0], a[1])
koch(n, a, b)
print(b[0], b[1])


import math

class Point:

	def __init__(self, x=None, y=None):
		self.x = x
		self.y = y

def koch(n, p1, p2):
	if n == 0:
		return
	(s, t, u) = [Point() for _ in range(3)]
	s.x = (2 * p1.x + p2.x) / 3
	s.y = (2 * p1.y + p2.y) / 3
	t.x = (p1.x + 2 * p2.x) / 3
	t.y = (p1.y + 2 * p2.y) / 3
	a = math.radians(60)
	u.x = (t.x - s.x) * math.cos(a) - (t.y - s.y) * math.sin(a) + s.x
	u.y = (t.x - s.x) * math.sin(a) + (t.y - s.y) * math.cos(a) + s.y
	koch(n - 1, p1, s)
	print(s.x, s.y)
	koch(n - 1, s, u)
	print(u.x, u.y)
	koch(n - 1, u, t)
	print(t.x, t.y)
	koch(n - 1, t, p2)
p1 = Point(0, 0)
p2 = Point(100, 0)
n = int(input())
print(p1.x, p1.y)
koch(n, p1, p2)
print(p2.x, p2.y)


import math

def plot(x, y):
	print(f'{x:.8f} {y:.8f}')

def Koch(n, x1, y1, x2, y2):
	if n == 0:
		plot(x1, y1)
		return
	sx = (2 * x1 + x2) / 3
	sy = (2 * y1 + y2) / 3
	tx = (x1 + 2 * x2) / 3
	ty = (y1 + 2 * y2) / 3
	ux = (tx - sx) * (1 / 2) - (ty - sy) * (math.sqrt(3) / 2) + sx
	uy = (tx - sx) * (math.sqrt(3) / 2) + (ty - sy) * (1 / 2) + sy
	Koch(n - 1, x1, y1, sx, sy)
	Koch(n - 1, sx, sy, ux, uy)
	Koch(n - 1, ux, uy, tx, ty)
	Koch(n - 1, tx, ty, x2, y2)
n = int(input())
Koch(n, 0, 0, 100, 0)
print('100.00000000 0.00000000')


def koch_curve(n, x1, y1, x2, y2):
	if n == 0:
		return [(x1, y1)]
	s_x = (2 * x1 + x2) / 3
	s_y = (2 * y1 + y2) / 3
	t_x = (x1 + 2 * x2) / 3
	t_y = (y1 + 2 * y2) / 3
	u_x = (t_x - s_x) * 0.5 - (t_y - s_y) * (3 ** 0.5 / 2) + s_x
	u_y = (t_x - s_x) * (3 ** 0.5 / 2) + (t_y - s_y) * 0.5 + s_y
	ret = koch_curve(n - 1, x1, y1, s_x, s_y) + koch_curve(n - 1, s_x, s_y, u_x, u_y) + koch_curve(n - 1, u_x, u_y, t_x, t_y) + koch_curve(n - 1, t_x, t_y, x2, y2)
	return ret
for (x, y) in koch_curve(int(input()), 0, 0, 100, 0):
	print('{:.8f} {:.8f}'.format(x, y))
print('{:.8f} {:.8f}'.format(100, 0))


import math

def koch(n, p1, p2):
	if n == 0:
		return
	s = [0 for i in range(2)]
	t = [0 for i in range(2)]
	u = [0 for i in range(2)]
	s[0] = (2 * p1[0] + 1 * p2[0]) / 3
	s[1] = (2 * p1[1] + 1 * p2[1]) / 3
	t[0] = (1 * p1[0] + 2 * p2[0]) / 3
	t[1] = (1 * p1[1] + 2 * p2[1]) / 3
	rad = math.radians(60)
	u[0] = (t[0] - s[0]) * math.cos(rad) - (t[1] - s[1]) * math.sin(rad) + s[0]
	u[1] = (t[0] - s[0]) * math.sin(rad) + (t[1] - s[1]) * math.cos(rad) + s[1]
	koch(n - 1, p1, s)
	print(*s)
	koch(n - 1, s, u)
	print(*u)
	koch(n - 1, u, t)
	print(*t)
	koch(n - 1, t, p2)
n = int(input())
p1 = [0, 0]
p2 = [100, 0]
print(*p1)
koch(n, p1, p2)
print(*p2)


import math

def rotate(x, y):
	r3 = math.sqrt(3)
	x2 = x / 2 - y * r3 / 2
	y2 = x * r3 / 2 + y / 2
	return (x2, y2)

def divide(a, b):
	m1 = [(b[0] - a[0]) / 3 + a[0], (b[1] - a[1]) / 3 + a[1]]
	m2 = [(b[0] - a[0]) * 2 / 3 + a[0], (b[1] - a[1]) * 2 / 3 + a[1]]
	r = rotate(m2[0] - m1[0], m2[1] - m1[1])
	m = [m1[0] + r[0], m1[1] + r[1]]
	return (a, m1, m, m2, b)
n = int(input())
arr = ([0, 0], [100, 0])
for i in range(n):
	tmp = []
	for j in range(len(arr) - 1):
		r = divide(arr[j], arr[j + 1])
		if j > 0:
			r = r[1:]
		tmp += r
	arr = tmp
for a in arr:
	print(' '.join(map(lambda x: str(round(x, 8)), a)))


import math

def plot(x, y):
	print(f'{x:.8f} {y:.8f}')

def koch(n, x1, y1, x2, y2):
	if n == 0:
		plot(x1, y1)
		return
	sx = (2 * x1 + x2) / 3
	sy = (2 * y1 + y2) / 3
	tx = (x1 + 2 * x2) / 3
	ty = (y1 + 2 * y2) / 3
	ux = (tx - sx) * (1 / 2) - (ty - sy) * (math.sqrt(3) / 2) + sx
	uy = (tx - sx) * (math.sqrt(3) / 2) + (ty - sy) * (1 / 2) + sy
	koch(n - 1, x1, y1, sx, sy)
	koch(n - 1, sx, sy, ux, uy)
	koch(n - 1, ux, uy, tx, ty)
	koch(n - 1, tx, ty, x2, y2)
n = int(input())
koch(n, 0, 0, 100, 0)
plot(100, 0)


def koch(d, p0, p1):
	if d == n:
		return
	s = [(2 * p0[0] + p1[0]) / 3, (2 * p0[1] + p1[1]) / 3]
	t = [(2 * p1[0] + p0[0]) / 3, (2 * p1[1] + p0[1]) / 3]
	u = [(p0[0] + p1[0]) / 2 - (p1[1] - p0[1]) * (3 ** (1 / 2) / 6), (p1[1] + p0[1]) / 2 + (p1[0] - p0[0]) * (3 ** (1 / 2) / 6)]
	koch(d + 1, p0, s)
	print(*s)
	koch(d + 1, s, u)
	print(*u)
	koch(d + 1, u, t)
	print(*t)
	koch(d + 1, t, p1)
p0 = [0, 0]
p1 = [100, 0]
n = int(input())
print(*p0)
koch(0, p0, p1)
print(*p1)


import math

def plot(x, y):
	print(f'{x:.8f} {y:.8f}')

def koch(n, x1, y1, x2, y2):
	if n == 0:
		plot(x1, y1)
		return
	sx = (2 * x1 + x2) / 3
	sy = (2 * y1 + y2) / 3
	tx = (x1 + 2 * x2) / 3
	ty = (y1 + 2 * y2) / 3
	ux = (tx - sx) * (1 / 2) - (ty - sy) * (math.sqrt(3) / 2) + sx
	uy = (tx - sx) * (math.sqrt(3) / 2) + (ty - sy) * (1 / 2) + sy
	koch(n - 1, x1, y1, sx, sy)
	koch(n - 1, sx, sy, ux, uy)
	koch(n - 1, ux, uy, tx, ty)
	koch(n - 1, tx, ty, x2, y2)
n = int(input())
koch(n, 0, 0, 100, 0)
plot(100, 0)


n = int(input())

def three_points(p1, p2):
	q1 = ((2 * p1[0] + p2[0]) / 3, (2 * p1[1] + p2[1]) / 3)
	q2 = ((p1[0] + 2 * p2[0]) / 3, (p1[1] + 2 * p2[1]) / 3)
	(dx, dy) = (p2[0] - p1[0], p2[1] - p1[1])
	q3 = (p1[0] + dx / 2 - 3 ** 0.5 / 6 * dy, p1[1] + dy / 2 + 3 ** 0.5 / 6 * dx)
	return [q1, q3, q2]
m = [(0, 0), (100, 0)]
for i in range(n):
	tmpm = []
	for j in range(len(m) - 1):
		tmpm += [m[j]] + three_points(m[j], m[j + 1])
	tmpm += [m[-1]]
	m = tmpm
for x in m:
	print(x[0], x[1])


import math

def rot60(s, t):
	v = t - s
	a = 1 / 2 + complex(0, math.sqrt(3) / 2)
	return v * a + s

def pr(p):
	x = p.real
	y = p.imag
	print('%.10f %.10f' % (x, y))

def dfs(p1, p2, n):
	if n == 0:
		return
	s = (p2 - p1) * (1 / 3) + p1
	t = (p2 - p1) * (2 / 3) + p1
	u = rot60(s, t)
	dfs(p1, s, n - 1)
	pr(s)
	dfs(s, u, n - 1)
	pr(u)
	dfs(u, t, n - 1)
	pr(t)
	dfs(t, p2, n - 1)
n = int(input())
s = 0 + 0j
t = 100 + 0j
pr(s)
dfs(s, t, n)
pr(t)


from typing import List
import math

def koch_curve(n: int, p1: List[float], p2: List[float]):
	if n == 0:
		return
	(p1x, p1y) = p1
	(p2x, p2y) = p2
	s = [(r - l) / 3 + l for (l, r) in zip(p1, p2)]
	t = [(r - l) * 2 / 3 + l for (l, r) in zip(p1, p2)]
	(sx, sy) = s
	(tx, ty) = t
	ux = (tx - sx) * math.cos(math.radians(60)) - (ty - sy) * math.sin(math.radians(60)) + sx
	uy = (tx - sx) * math.sin(math.radians(60)) + (ty - sy) * math.cos(math.radians(60)) + sy
	u = [ux, uy]
	n -= 1
	koch_curve(n, p1, s)
	print(*s)
	koch_curve(n, s, u)
	print(*u)
	koch_curve(n, u, t)
	print(*t)
	koch_curve(n, t, p2)
n = int(input())
p1 = [0, 0]
p2 = [100, 0]
print(*p1)
koch_curve(n, p1, p2)
print(*p2)


def devide2points(p1, p2):
	s = ((p1[0] * 2 + p2[0]) / 3, (p1[1] * 2 + p2[1]) / 3)
	t = ((p1[0] + p2[0] * 2) / 3, (p1[1] + p2[1] * 2) / 3)
	u = ((p1[0] + p2[0]) / 2 - (p2[1] - p1[1]) * 3 ** (1 / 2) / 6, (p1[1] + p2[1]) / 2 + (p2[0] - p1[0]) * 3 ** (1 / 2) / 6)
	return [s, u, t]

def divide(points):
	res = [points[0]]
	for i in range(len(points) - 1):
		res = res + devide2points(points[i], points[i + 1]) + [points[i + 1]]
	return res
n = int(input())
points = [(0.0, 0.0), (100.0, 0.0)]
for _ in range(n):
	points = divide(points)
for i in points:
	print(i[0], i[1])


def recKF(p1, p2, n):
	if n != 0:
		a = 1 / 2
		b = 3 ** (1 / 2) / 2
		s = Point(p1.x + (p2.x - p1.x) / 3, p1.y + (p2.y - p1.y) / 3)
		t = Point(p1.x + (p2.x - p1.x) * 2 / 3, p1.y + (p2.y - p1.y) * 2 / 3)
		v = Point(t.x - s.x, t.y - s.y)
		rot_v = Point(v.x * a - v.y * b, b * v.x + a * v.y)
		u = Point(rot_v.x + s.x, rot_v.y + s.y)
		recKF(p1, s, n - 1)
		print(s.x, s.y)
		recKF(s, u, n - 1)
		print(u.x, u.y)
		recKF(u, t, n - 1)
		print(t.x, t.y)
		recKF(t, p2, n - 1)
from collections import namedtuple
Point = namedtuple('Point', ['x', 'y'])
p1 = Point(0, 0)
p2 = Point(100, 0)
n = int(input())
print(p1.x, p1.y)
recKF(p1, p2, n)
print(p2.x, p2.y)


import math

def koch(n, p1, p2):
	if n == 0:
		return
	s = ((2 * p1[0] + 1 * p2[0]) / 3, (2 * p1[1] + 1 * p2[1]) / 3)
	t = ((1 * p1[0] + 2 * p2[0]) / 3, (1 * p1[1] + 2 * p2[1]) / 3)
	u = ((t[0] - s[0]) * math.cos(math.radians(60)) - (t[1] - s[1]) * math.sin(math.radians(60)) + s[0], (t[0] - s[0]) * math.sin(math.radians(60)) + (t[1] - s[1]) * math.cos(math.radians(60)) + s[1])
	koch(n - 1, p1, s)
	print(' {0:.8f} {1:.8f}'.format(*s))
	koch(n - 1, s, u)
	print('{0:.8f} {1:.8f}'.format(*u))
	koch(n - 1, u, t)
	print('{0:.8f} {1:.8f}'.format(*t))
	koch(n - 1, t, p2)
p1 = (0, 0)
p2 = (100, 0)
n = int(input())
print('{0:.8f} {1:.8f}'.format(*p1))
koch(n, p1, p2)
print('{0:.8f} {1:.8f}'.format(*p2))


import math
n = int(input())
p0 = (0, 0)
p1 = (100, 0)

def koch(depth, p0, p1):
	if depth == 0:
		return
	sx = (2 * p0[0] + 1 * p1[0]) / 3
	sy = (2 * p0[1] + 1 * p1[1]) / 3
	s = (sx, sy)
	tx = (1 * p0[0] + 2 * p1[0]) / 3
	ty = (1 * p0[1] + 2 * p1[1]) / 3
	t = (tx, ty)
	theta = math.radians(60)
	ux = (tx - sx) * math.cos(theta) - (ty - sy) * math.sin(theta) + sx
	uy = math.sin(theta) * (tx - sx) + math.cos(theta) * (ty - sy) + sy
	u = (ux, uy)
	koch(depth - 1, p0, s)
	print(*s)
	koch(depth - 1, s, u)
	print(*u)
	koch(depth - 1, u, t)
	print(*t)
	koch(depth - 1, t, p1)
print(*p0)
koch(n, p0, p1)
print(*p1)


import math
n = int(input())

def koch(n, a, b):
	if n == 0:
		return
	th = math.pi * 60 / 180
	s = ((2 * a[0] + b[0]) / 3, (2 * a[1] + b[1]) / 3)
	t = ((a[0] + 2 * b[0]) / 3, (a[1] + 2 * b[1]) / 3)
	u = ((t[0] - s[0]) * math.cos(th) - (t[1] - s[1]) * math.sin(th) + s[0], (t[0] - s[0]) * math.sin(th) + (t[1] - s[1]) * math.cos(th) + s[1])
	koch(n - 1, a, s)
	print(s[0], s[1])
	koch(n - 1, s, u)
	print(u[0], u[1])
	koch(n - 1, u, t)
	print(t[0], t[1])
	koch(n - 1, t, b)
a = (0, 0)
b = (100, 0)
print(a[0], a[1])
koch(n, a, b)
print(b[0], b[1])


import math
n = int(input())
p1 = (0, 0)
p2 = (100, 0)

def kock(n, p1, p2):
	if n == 0:
		return
	sx = 2 / 3 * p1[0] + 1 / 3 * p2[0]
	sy = 2 / 3 * p1[1] + 1 / 3 * p2[1]
	s = (sx, sy)
	tx = 1 / 3 * p1[0] + 2 / 3 * p2[0]
	ty = 1 / 3 * p1[1] + 2 / 3 * p2[1]
	t = (tx, ty)
	ux = math.cos(math.radians(60)) * (tx - sx) - math.sin(math.radians(60)) * (ty - sy) + sx
	uy = math.sin(math.radians(60)) * (tx - sx) + math.cos(math.radians(60)) * (ty - sy) + sy
	u = (ux, uy)
	kock(n - 1, p1, s)
	print(*s)
	kock(n - 1, s, u)
	print(*u)
	kock(n - 1, u, t)
	print(*t)
	kock(n - 1, t, p2)
print(*p1)
kock(n, p1, p2)
print(*p2)


import math
sin = math.sin(math.pi / 3)
cos = math.cos(math.pi / 3)
n = int(input())
(p1, p2) = ((0, 0), (100, 0))
ans_ls = [p1, p2]

def koch(d, p1, p2):
	if d == n:
		return
	s = (2 / 3 * p1[0] + 1 / 3 * p2[0], 2 / 3 * p1[1] + 1 / 3 * p2[1])
	t = (1 / 3 * p1[0] + 2 / 3 * p2[0], 1 / 3 * p1[1] + 2 / 3 * p2[1])
	u = ((t[0] - s[0]) * cos - (t[1] - s[1]) * sin + s[0], (t[0] - s[0]) * sin + (t[1] - s[1]) * cos + s[1])
	ans_ls.extend([s, u, t])
	koch(d + 1, p1, s)
	print(*s)
	koch(d + 1, s, u)
	print(*u)
	koch(d + 1, u, t)
	print(*t)
	koch(d + 1, t, p2)
print(*p1)
koch(0, p1, p2)
print(*p2)


def solve(i, x1, x2, y1, y2):
	global n
	if i == n:
		return print(x2, y2)
	X1 = (2 * x1 + x2) / 3
	Y1 = (2 * y1 + y2) / 3
	X3 = (x1 + 2 * x2) / 3
	Y3 = (y1 + 2 * y2) / 3
	X2 = (X3 + X1) / 2 + 3 ** 0.5 * (Y1 - Y3) / 2
	Y2 = (3 ** 0.5 * (X3 - X1) + (Y1 + Y3)) / 2
	solve(i + 1, x1, X1, y1, Y1)
	solve(i + 1, X1, X2, Y1, Y2)
	solve(i + 1, X2, X3, Y2, Y3)
	solve(i + 1, X3, x2, Y3, y2)
n = int(input())
print(0, 0)
solve(0, 0, 100, 0, 0)


import math

def koch(n, p1, p2):
	if n == 0:
		return
	sx = (2 * p1[0] + p2[0]) / 3
	sy = (2 * p1[1] + p2[1]) / 3
	s = (sx, sy)
	tx = (p1[0] + 2 * p2[0]) / 3
	ty = (p1[1] + 2 * p2[1]) / 3
	t = (tx, ty)
	ux = (tx - sx) * math.cos(math.pi / 3) - (ty - sy) * math.sin(math.pi / 3) + sx
	uy = (tx - sx) * math.sin(math.pi / 3) + (ty - sy) * math.cos(math.pi / 3) + sy
	u = (ux, uy)
	koch(n - 1, p1, s)
	print(s[0], s[1])
	koch(n - 1, s, u)
	print(u[0], u[1])
	koch(n - 1, u, t)
	print(t[0], t[1])
	koch(n - 1, t, p2)
n = int(input())
p1 = (0, 0)
p2 = (100, 0)
print(0, 0)
koch(n, p1, p2)
print(100, 0)


import math

def kochCurve(p1, p2, n):
	if n == 0:
		print(p2[0], p2[1])
		return
	v = [(p2[0] - p1[0]) / 3, (p2[1] - p1[1]) / 3]
	s = [p1[0] + v[0], p1[1] + v[1]]
	t = [s[0] + v[0], s[1] + v[1]]
	theta = math.atan2(v[1], v[0]) + math.pi / 2
	a = math.sqrt((t[0] - s[0]) ** 2 + (t[1] - s[1]) ** 2)
	h = 3 ** (1 / 2) * a / 2
	u = [s[0] + (t[0] - s[0]) / 2 + h * math.cos(theta), s[1] + (t[1] - s[1]) / 2 + h * math.sin(theta)]
	n -= 1
	kochCurve(p1, s, n)
	kochCurve(s, u, n)
	kochCurve(u, t, n)
	kochCurve(t, p2, n)
n = int(input())
print(0, 0)
kochCurve([0, 0], [100, 0], n)


def koch_divide(p, q):
	v = [q[0] - p[0], q[1] - p[1]]
	s = [p[0] + v[0] / 3, p[1] + v[1] / 3]
	t = [q[0] - v[0] / 3, q[1] - v[1] / 3]
	u = [p[0] + v[0] * 0.5 - v[1] * 0.288675, p[1] + v[0] * 0.288675 + v[1] * 0.5]
	return [s, u, t, q]

def koch_curve(previous):
	vertices = [previous[0]]
	for (p, q) in zip(previous[:-1], previous[1:]):
		vertices.extend(koch_divide(p, q))
	return vertices
p_q = [[0.0, 0.0], [100.0, 0.0]]
n = int(input())
for _ in range(n):
	p_q = koch_curve(p_q)
for vertex in p_q:
	print(' '.join(['{:.8f}'.format(x) for x in vertex]))


import math

def koch(d, p1, p2):
	if d == 0:
		return
	x = p2[0] - p1[0]
	y = p2[1] - p1[1]
	s = [(p1[0] * 2 + p2[0] * 1) / 3.0, (p1[1] * 2 + p2[1] * 1) / 3.0]
	t = [(p1[0] * 1 + p2[0] * 2) / 3.0, (p1[1] * 1 + p2[1] * 2) / 3.0]
	u = [p1[0] + x / 2 - y * math.sqrt(3) / 6, p1[1] + y / 2 + x * math.sqrt(3) / 6]
	koch(d - 1, p1, s)
	print(*s)
	koch(d - 1, s, u)
	print(*u)
	koch(d - 1, u, t)
	print(*t)
	koch(d - 1, t, p2)
n = int(input())
p1 = [0, 0]
p2 = [100, 0]
print(*p1)
koch(n, p1, p2)
print(*p2)


import math
n = int(input())
point = [(0, 0), (100, 0)]
for i in range(n):
	len_point = len(point)
	tmp = []
	for j in range(len_point - 1):
		(x1, y1) = point[j]
		(x2, y2) = point[j + 1]
		(sx, sy) = ((2 * x1 + x2) / 3, (2 * y1 + y2) / 3)
		(tx, ty) = ((x1 + 2 * x2) / 3, (y1 + 2 * y2) / 3)
		ux = (tx - sx) * math.cos(math.pi / 3) - (ty - sy) * math.sin(math.pi / 3) + sx
		uy = (tx - sx) * math.sin(math.pi / 3) + (ty - sy) * math.cos(math.pi / 3) + sy
		tmp.append((x1, y1))
		tmp.append((sx, sy))
		tmp.append((ux, uy))
		tmp.append((tx, ty))
	tmp.append((100, 0))
	point = tmp
for (x, y) in point:
	print(f'{x:.8f} {y:.8f}')


import math

def koch(d, p1x, p1y, p2x, p2y):
	if d == 0:
		return 0
	sin = math.sin(math.radians(60))
	cos = math.cos(math.radians(60))
	ax = (2 * p1x + 1 * p2x) / 3
	ay = (2 * p1y + 1 * p2y) / 3
	bx = (1 * p1x + 2 * p2x) / 3
	by = (1 * p1y + 2 * p2y) / 3
	ux = (bx - ax) * cos - (by - ay) * sin + ax
	uy = (bx - ax) * sin + (by - ay) * cos + ay
	koch(d - 1, p1x, p1y, ax, ay)
	print(ax, ay)
	koch(d - 1, ax, ay, ux, uy)
	print(ux, uy)
	koch(d - 1, ux, uy, bx, by)
	print(bx, by)
	koch(d - 1, bx, by, p2x, p2y)
d = int(input())
print(0, 0)
koch(d, 0, 0, 100, 0)
print(100, 0)


from math import *
a = (0, 0)
b = (100, 0)

def koch(n, ax, ay, bx, by):
	if n == 0:
		return 0
	th = pi / 3
	sx = (2 * ax + bx) / 3
	sy = (2 * ay + by) / 3
	tx = (ax + 2 * bx) / 3
	ty = (ay + 2 * by) / 3
	ux = (tx - sx) * cos(th) - (ty - sy) * sin(th) + sx
	uy = (tx - sx) * sin(th) + (ty - sy) * cos(th) + sy
	koch(n - 1, ax, ay, sx, sy)
	print(sx, sy)
	koch(n - 1, sx, sy, ux, uy)
	print(ux, uy)
	koch(n - 1, ux, uy, tx, ty)
	print(tx, ty)
	koch(n - 1, tx, ty, bx, by)
n = int(input())
print(*a)
koch(n, *a, *b)
print(*b)


import math

def Koch(Px, Py, Qx, Qy, n):
	if n == 0:
		return
	else:
		Ax = (2 * Px + Qx) / 3
		Ay = (2 * Py + Qy) / 3
		Bx = (Px + 2 * Qx) / 3
		By = (Py + 2 * Qy) / 3
		Cx = Ax + (Bx - Ax) * math.cos(math.pi / 3) - (By - Ay) * math.sin(math.pi / 3)
		Cy = Ay + (Bx - Ax) * math.sin(math.pi / 3) + (By - Ay) * math.cos(math.pi / 3)
		Koch(Px, Py, Ax, Ay, n - 1)
		print(Ax, Ay)
		Koch(Ax, Ay, Cx, Cy, n - 1)
		print(Cx, Cy)
		Koch(Cx, Cy, Bx, By, n - 1)
		print(Bx, By)
		Koch(Bx, By, Qx, Qy, n - 1)
n = int(input())
print(0, 0.0)
Koch(0.0, 0.0, 100.0, 0.0, n)
print(100.0, 0.0)


import cmath

def f():
	global d
	p = []
	for i in range(len(d) - 1):
		(a, b) = (d[i], d[i + 1])
		r = (b - a) / 3
		p += [a, a + r, a + r + r * (1 + 3 ** 0.5 * 1j) / 2, b - r]
	d = p + [d[-1]]
d = [0j, 100 + 0j]
for _ in [0] * int(input()):
	f()
for e in d:
	print(e.real, e.imag)


d = int(input().rstrip())
import math
sin60 = math.sin(math.radians(60))
cos60 = math.cos(math.radians(60))

def make_koch(d, p1, p2):
	s = ((p1[0] * 2 + p2[0]) / 3, (p1[1] * 2 + p2[1]) / 3)
	t = ((p1[0] + p2[0] * 2) / 3, (p1[1] + p2[1] * 2) / 3)
	u = ((t[0] - s[0]) * cos60 - (t[1] - s[1]) * sin60 + s[0], (t[0] - s[0]) * sin60 + (t[1] - s[1]) * cos60 + s[1])
	if d == 0:
		return [p1]
	elif d == 1:
		return [p1, s, u, t]
	else:
		return make_koch(d - 1, p1, s) + make_koch(d - 1, s, u) + make_koch(d - 1, u, t) + make_koch(d - 1, t, p2)
result_list = make_koch(d, (0, 0), (100, 0))
for result in result_list:
	print(result[0], result[1])
print('100 0')


def f():
	global d
	p = []
	for i in range(len(d) - 1):
		(a, b) = (d[i], d[i + 1])
		r = (b - a) / 3
		p += [a, a + r, (a + b) / 2 + r * 1j * 3 ** 0.5 / 2, b - r]
	d = p + [d[-1]]
d = [0j, 100 + 0j]
for _ in [0] * int(input()):
	f()
for e in d:
	print(e.real, e.imag)


import math

def koch(d, p1, p2):
	if d == 0:
		return
	v = [p2[0] - p1[0], p2[1] - p1[1]]
	s = [p1[0] + v[0] / 3, p1[1] + v[1] / 3]
	t = [p1[0] + 2 * v[0] / 3, p1[1] + 2 * v[1] / 3]
	u = [p1[0] + v[0] / 2 - v[1] * math.sqrt(3) / 6, p1[1] + v[1] / 2 + v[0] * math.sqrt(3) / 6]
	koch(d - 1, p1, s)
	print(' '.join(map(str, s)))
	koch(d - 1, s, u)
	print(' '.join(map(str, u)))
	koch(d - 1, u, t)
	print(' '.join(map(str, t)))
	koch(d - 1, t, p2)
n = int(input())
print('0 0')
koch(n, [0, 0], [100, 0])
print('100 0')


n = int(input())
p = [[0, 0]]
r3 = 1.7320508

def unit_koch(p1, p2, d):
	if d >= n:
		return
	s = [(p1[0] * 2 + p2[0]) / 3, (p1[1] * 2 + p2[1]) / 3]
	t = [(p1[0] + p2[0] * 2) / 3, (p1[1] + p2[1] * 2) / 3]
	v_s_t = [t[0] - s[0], t[1] - s[1]]
	v_s_u = [v_s_t[0] / 2 - v_s_t[1] * r3 / 2, v_s_t[1] / 2 + v_s_t[0] * r3 / 2]
	u = [s[0] + v_s_u[0], s[1] + v_s_u[1]]
	unit_koch(p1, s, d + 1)
	p.append(s)
	unit_koch(s, u, d + 1)
	p.append(u)
	unit_koch(u, t, d + 1)
	p.append(t)
	unit_koch(t, p2, d + 1)
unit_koch([0, 0], [100, 0], 0)
p.append([100, 0])
for i in p:
	print(str(i[0]) + ' ' + str(i[1]))


import math
n = int(input())

def koch(n, a, b):
	if n == 0:
		return
	th = math.pi * 60.0 / 180.0
	(s, t, u) = ([0, 0], [0, 0], [0, 0])
	s[0] = (2.0 * a[0] + 1.0 * b[0]) / 3.0
	s[1] = (2.0 * a[1] + 1.0 * b[1]) / 3.0
	t[0] = (1.0 * a[0] + 2.0 * b[0]) / 3.0
	t[1] = (1.0 * a[1] + 2.0 * b[1]) / 3.0
	u[0] = (t[0] - s[0]) * math.cos(th) - (t[1] - s[1]) * math.sin(th) + s[0]
	u[1] = (t[0] - s[0]) * math.sin(th) + (t[1] - s[1]) * math.cos(th) + s[1]
	koch(n - 1, a, s)
	print(s[0], s[1])
	koch(n - 1, s, u)
	print(u[0], u[1])
	koch(n - 1, u, t)
	print(t[0], t[1])
	koch(n - 1, t, b)
a = [0, 0]
b = [100, 0]
print(a[0], a[1])
koch(n, a, b)
print(b[0], b[1])


import math
n = int(input())

def koch(c, px, py, qx, qy):
	if c > 0:
		sx = (2 * px + qx) / 3
		sy = (2 * py + qy) / 3
		tx = (px + 2 * qx) / 3
		ty = (py + 2 * qy) / 3
		ux = (tx - sx) * math.cos(math.radians(60)) - (ty - sy) * math.sin(math.radians(60)) + sx
		uy = (tx - sx) * math.sin(math.radians(60)) + (ty - sy) * math.cos(math.radians(60)) + sy
		koch(c - 1, px, py, sx, sy)
		S = [sx, sy]
		print(' '.join(map(str, S)))
		koch(c - 1, sx, sy, ux, uy)
		U = [ux, uy]
		print(' '.join(map(str, U)))
		koch(c - 1, ux, uy, tx, ty)
		T = [tx, ty]
		print(' '.join(map(str, T)))
		koch(c - 1, tx, ty, qx, qy)
print('0 0')
koch(n, 0, 0, 100, 0)
print('100 0')


import math
n = int(input())
start = (0, 0)
end = (100, 0)

def koch(n, p1, p2):
	if n == 0:
		return
	s = ((p1[0] * 2 + p2[0]) / 3, (p1[1] * 2 + p2[1]) / 3)
	t = ((p1[0] + p2[0] * 2) / 3, (p1[1] + p2[1] * 2) / 3)
	ux = (t[0] - s[0]) / 2 - (t[1] - s[1]) * math.sqrt(3) / 2 + s[0]
	uy = (t[0] - s[0]) * math.sqrt(3) / 2 + (t[1] - s[1]) / 2 + s[1]
	u = (ux, uy)
	koch(n - 1, p1, s)
	ppp(s)
	koch(n - 1, s, u)
	ppp(u)
	koch(n - 1, u, t)
	ppp(t)
	koch(n - 1, t, p2)

def ppp(t):
	print('{:.08f} {:.08f}'.format(t[0], t[1]))
ppp(start)
koch(n, start, end)
ppp(end)


from math import *

def koch(n, a, b):
	if n == 0:
		return
	th = pi * 60.0 / 180.0
	s = complex((2.0 * a.real + 1.0 * b.real) / 3.0, (2.0 * a.imag + 1.0 * b.imag) / 3.0)
	t = complex((1.0 * a.real + 2.0 * b.real) / 3.0, (1.0 * a.imag + 2.0 * b.imag) / 3.0)
	u = complex((t.real - s.real) * cos(th) - (t.imag - s.imag) * sin(th) + s.real, (t.real - s.real) * sin(th) + (t.imag - s.imag) * cos(th) + s.imag)
	koch(n - 1, a, s)
	print(s.real, s.imag)
	koch(n - 1, s, u)
	print(u.real, u.imag)
	koch(n - 1, u, t)
	print(t.real, t.imag)
	koch(n - 1, t, b)
n = int(input())
a = complex(0, 0)
b = complex(100, 0)
print(a.real, a.imag)
koch(n, a, b)
print(b.real, b.imag)


from collections import namedtuple
import math
Co = namedtuple('Co', 'x y')

def f(i, n, l, r):
	if i >= n:
		print(l.x, l.y)
		return
	il = Co(x=1 / 3 * r.x + (1 - 1 / 3) * l.x, y=1 / 3 * r.y + (1 - 1 / 3) * l.y)
	ir = Co(x=2 / 3 * r.x + (1 - 2 / 3) * l.x, y=2 / 3 * r.y + (1 - 2 / 3) * l.y)
	trix = 1 / 2 * (ir.x + il.x - math.sqrt(3) * ir.y + math.sqrt(3) * il.y)
	triy = 1 / 2 * (math.sqrt(3) * ir.x - math.sqrt(3) * il.x + ir.y + il.y)
	trico = Co(trix, triy)
	f(i + 1, n, l, il)
	f(i + 1, n, il, trico)
	f(i + 1, n, trico, ir)
	f(i + 1, n, ir, r)
n = int(input())
f(0, n, Co(0, 0), Co(100, 0))
print(100, 0)


import math
cos60 = math.cos(math.radians(60))
sin60 = math.sin(math.radians(60))

def knoc(n, l, r):
	if n == 0:
		return
	s = ((2 * l[0] + r[0]) / 3, (2 * l[1] + r[1]) / 3)
	t = ((l[0] + 2 * r[0]) / 3, (l[1] + 2 * r[1]) / 3)
	ux = (t[0] - s[0]) * cos60 - (t[1] - s[1]) * sin60 + s[0]
	uy = (t[0] - s[0]) * sin60 + (t[1] - s[1]) * cos60 + s[1]
	u = (ux, uy)
	knoc(n - 1, l, s)
	print(s[0], s[1])
	knoc(n - 1, s, u)
	print(u[0], u[1])
	knoc(n - 1, u, t)
	print(t[0], t[1])
	knoc(n - 1, t, r)
n = int(input())
start = (0, 0)
end = (100, 0)
print(start[0], start[1])
knoc(n, start, end)
print(end[0], end[1])


def f():
	global d
	p = []
	for i in range(len(d) - 1):
		(a, b) = (d[i], d[i + 1])
		r = (b - a) / 3
		p += [a, a + r, a + r + r * (0.5 + 3 ** 0.5 * 0.5j), b - r]
	d = p + [d[-1]]
d = [0j, 100 + 0j]
for _ in [0] * int(input()):
	f()
for e in d:
	print(e.real, e.imag)


def f():
	global d
	p = []
	for i in range(len(d) - 1):
		(a, b) = (d[i], d[i + 1])
		r = (b - a) / 3
		(u, t) = (r + a + r * (1 + 3 ** 0.5 * 1j) / 2, b - r)
		p += [a, r + a, u, t]
	d = p + [d[-1]]
d = [0j, 100 + 0j]
for _ in [0] * int(input()):
	f()
for e in d:
	print(e.real, e.imag)


from math import sqrt
from functools import reduce
N = int(input())

def koch(p1, p2, n):
	if n == 0:
		return [p1, p2]
	else:
		c1 = [(2 * p1[0] + p2[0]) / 3, (2 * p1[1] + p2[1]) / 3]
		c3 = [(p1[0] + 2 * p2[0]) / 3, (p1[1] + 2 * p2[1]) / 3]
		c2 = [(p1[0] + p2[0]) / 2 + 1 / sqrt(3) * (p1[1] - p2[1]) / 2, (p1[1] + p2[1]) / 2 + 1 / sqrt(3) * (p2[0] - p1[0]) / 2]
		return koch(p1, c1, n - 1)[:-1] + koch(c1, c2, n - 1)[:-1] + koch(c2, c3, n - 1)[:-1] + koch(c3, p2, n - 1)
for p in koch([0.0, 0.0], [100.0, 0.0], N):
	print('{:.6f} {:.6f}'.format(p[0], p[1]))


import math

def koch(n, p1x, p1y, p2x, p2y):
	if n == 0:
		return
	sx = (2 * p1x + 1 * p2x) / 3
	sy = (2 * p1y + 1 * p2y) / 3
	tx = (1 * p1x + 2 * p2x) / 3
	ty = (1 * p1y + 2 * p2y) / 3
	theta = math.pi / 3
	ux = math.cos(theta) * (tx - sx) - math.sin(theta) * (ty - sy) + sx
	uy = math.sin(theta) * (tx - sx) + math.cos(theta) * (ty - sy) + sy
	koch(n - 1, p1x, p1y, sx, sy)
	print('{:.8f} {:.8f}'.format(sx, sy))
	koch(n - 1, sx, sy, ux, uy)
	print('{:.8f} {:.8f}'.format(ux, uy))
	koch(n - 1, ux, uy, tx, ty)
	print('{:.8f} {:.8f}'.format(tx, ty))
	koch(n - 1, tx, ty, p2x, p2y)
n = int(input())
(p1x, p1y) = (0.0, 0.0)
(p2x, p2y) = (100.0, 0.0)
print('{:.8f} {:.8f}'.format(p1x, p1y))
koch(n, p1x, p1y, p2x, p2y)
print('{:.8f} {:.8f}'.format(p2x, p2y))


import math

def Koch(tops):
	n = len(tops)
	new_tops = [tops[0]]
	for i in range(n - 1):
		b = [0, 0]
		a = [2 * tops[i][0] / 3 + tops[i + 1][0] / 3, 2 * tops[i][1] / 3 + tops[i + 1][1] / 3]
		c = [tops[i][0] / 3 + 2 * tops[i + 1][0] / 3, tops[i][1] / 3 + 2 * tops[i + 1][1] / 3]
		b[0] = (c[0] - a[0]) * math.cos(math.radians(60)) - (c[1] - a[1]) * math.sin(math.radians(60)) + a[0]
		b[1] = (c[0] - a[0]) * math.sin(math.radians(60)) + (c[1] - a[1]) * math.cos(math.radians(60)) + a[1]
		new_tops.append(a)
		new_tops.append(b)
		new_tops.append(c)
		new_tops.append(tops[i + 1])
	return new_tops
n = int(input())
tops = [[0.0, 0.0], [100.0, 0.0]]
for i in range(n):
	tops = Koch(tops)
for j in range(len(tops)):
	print(*tops[j], sep=' ')


import math

def koch(n, p1, p2):
	sx = 2 / 3 * p1[0] + 1 / 3 * p2[0]
	sy = 2 / 3 * p1[1] + 1 / 3 * p2[1]
	s = (sx, sy)
	tx = 1 / 3 * p1[0] + 2 / 3 * p2[0]
	ty = 1 / 3 * p1[1] + 2 / 3 * p2[1]
	t = (tx, ty)
	theta = math.radians(60)
	ux = (tx - sx) * math.cos(theta) - (ty - sy) * math.sin(theta) + sx
	uy = (tx - sx) * math.sin(theta) + (ty - sy) * math.cos(theta) + sy
	u = (ux, uy)
	if n > 0:
		koch(n - 1, p1, s)
		print(*s)
		koch(n - 1, s, u)
		print(*u)
		koch(n - 1, u, t)
		print(*t)
		koch(n - 1, t, p2)
	else:
		return
n = int(input())
a = [0.0, 0.0]
b = [100.0, 0.0]
print(*map(float, a))
koch(n, a, b)
print(*map(float, b))


import math
cos60 = math.cos(math.radians(60))
sin60 = math.sin(math.radians(60))

def koch(d, p1_x, p2_x, p1_y, p2_y):
	if d == 0:
		return
	s_x = (2 * p1_x + 1 * p2_x) / 3
	s_y = (2 * p1_y + 1 * p2_y) / 3
	t_x = (1 * p1_x + 2 * p2_x) / 3
	t_y = (1 * p1_y + 2 * p2_y) / 3
	u_x = (t_x - s_x) * cos60 - (t_y - s_y) * sin60 + s_x
	u_y = (t_x - s_x) * sin60 + (t_y - s_y) * cos60 + s_y
	koch(d - 1, p1_x, s_x, p1_y, s_y)
	print(s_x, s_y)
	koch(d - 1, s_x, u_x, s_y, u_y)
	print(u_x, u_y)
	koch(d - 1, u_x, t_x, u_y, t_y)
	print(t_x, t_y)
	koch(d - 1, t_x, p2_x, t_y, p2_y)
d = int(input())
p1_y = 0
p1_x = 0
p2_x = 100
p2_y = 0
print(float(p1_x), float(p1_y))
koch(d, p1_x, p2_x, p1_y, p2_y)
print(float(p2_x), float(p2_y))


from math import pi
from cmath import rect

def fromPolar(r, theta):
	return r * complex(cos(theta), sin(theta))

def print_xy(z):
	print(z.real, z.imag)

def koch(p1, p2, level):
	if level == 0:
		return
	l = p2 - p1
	s = p1 + 1 / 3 * l
	t = p1 + 2 / 3 * l
	u = s + 1 / 3 * l * rect(1, pi / 3)
	koch(p1, s, level - 1)
	print_xy(s)
	koch(s, u, level - 1)
	print_xy(u)
	koch(u, t, level - 1)
	print_xy(t)
	koch(t, p2, level - 1)

def main():
	n = int(input())
	print_xy(0 + 0j)
	koch(0 + 0j, 100 + 0j, n)
	print_xy(100 + 0j)
main()


from math import cos, sin, pi

def plot(x, y):
	print(f'{x:.8f} {y:.8f}')

def koch(n, x1, y1, x2, y2):
	if n == 0:
		plot(x1, y1)
		return
	sx = (2 * x1 + x2) / 3
	sy = (2 * y1 + y2) / 3
	tx = (x1 + 2 * x2) / 3
	ty = (y1 + 2 * y2) / 3
	ux = (tx - sx) * cos(pi / 3) - (ty - sy) * sin(pi / 3) + sx
	uy = (tx - sx) * sin(pi / 3) + (ty - sy) * cos(pi / 3) + sy
	koch(n - 1, x1, y1, sx, sy)
	koch(n - 1, sx, sy, ux, uy)
	koch(n - 1, ux, uy, tx, ty)
	koch(n - 1, tx, ty, x2, y2)
n = int(input())
koch(n, 0, 0, 100, 0)
plot(100, 0)


from math import *
c60 = cos(radians(60))
s60 = sin(radians(60))

def koch(d, p1, p2):
	if d == 0:
		return
	sx = (2 * p1[0] + p2[0]) / 3
	sy = (2 * p1[1] + p2[1]) / 3
	tx = (p1[0] + 2 * p2[0]) / 3
	ty = (p1[1] + 2 * p2[1]) / 3
	ux = (tx - sx) * c60 - (ty - sy) * s60 + sx
	uy = (tx - sx) * s60 + (ty - sy) * c60 + sy
	koch(d - 1, p1, (sx, sy))
	print('{0:.8f} {1:.8f}'.format(sx, sy))
	koch(d - 1, (sx, sy), (ux, uy))
	print('{0:.8f} {1:.8f}'.format(ux, uy))
	koch(d - 1, (ux, uy), (tx, ty))
	print('{0:.8f} {1:.8f}'.format(tx, ty))
	koch(d - 1, (tx, ty), p2)
n = int(input())
(ax, ay) = (0, 0)
(bx, by) = (100, 0)
print('{0:.8f} {1:.8f}'.format(ax, ay))
koch(n, (ax, ay), (bx, by))
print('{0:.8f} {1:.8f}'.format(bx, by))


import math
import os
import sys

def kochCurve(depth, p0, p1):
	if depth == 0:
		return
	sx = 2 / 3 * p0[0] + 1 / 3 * p1[0]
	sy = 2 / 3 * p0[1] + 1 / 3 * p1[1]
	s = (sx, sy)
	tx = 1 / 3 * p0[0] + 2 / 3 * p1[0]
	ty = 1 / 3 * p0[1] + 2 / 3 * p1[1]
	t = (tx, ty)
	angle = math.radians(60)
	ux = math.cos(angle) * (tx - sx) - math.sin(angle) * (ty - sy) + sx
	uy = math.sin(angle) * (tx - sx) + math.cos(angle) * (ty - sy) + sy
	u = (ux, uy)
	kochCurve(depth - 1, p0, s)
	print(*s)
	kochCurve(depth - 1, s, u)
	print(*u)
	kochCurve(depth - 1, u, t)
	print(*t)
	kochCurve(depth - 1, t, p1)
n = int(input())
p0 = (0, 0)
p1 = (100, 0)
print(*p0)
kochCurve(n, p0, p1)
print(*p1)


import math

def plot(x, y):
	print(f'{x:.8f} {y:.8f}')

def koch(n, x1, y1, x2, y2):
	if n == 0:
		plot(x1, y1)
		return
	sx = (2 * x1 + x2) / 3
	sy = (2 * y1 + y2) / 3
	tx = (x1 + 2 * x2) / 3
	ty = (y1 + 2 * y2) / 3
	ux = (tx - sx) * math.cos(math.pi / 3) - (ty - sy) * math.sin(math.pi / 3) + sx
	uy = (tx - sx) * math.sin(math.pi / 3) + (ty - sy) * math.cos(math.pi / 3) + sy
	koch(n - 1, x1, y1, sx, sy)
	koch(n - 1, sx, sy, ux, uy)
	koch(n - 1, ux, uy, tx, ty)
	koch(n - 1, tx, ty, x2, y2)
n = int(input())
koch(n, 0, 0, 100, 0)
plot(100, 0)


import random
import math

def hura(a):
	ind = 1
	for i in range(len(a) - 1):
		c = [(a[i * 4 + 1][0] - a[i * 4][0]) / 3 + a[i * 4][0], (a[i * 4 + 1][1] - a[i * 4][1]) / 3 + a[i * 4][1]]
		d = [(a[i * 4 + 1][0] - a[i * 4][0]) * 2 / 3 + a[i * 4][0], (a[i * 4 + 1][1] - a[i * 4][1]) * 2 / 3 + a[i * 4][1]]
		cos = math.cos(math.pi / 3)
		sin = math.sin(math.pi / 3)
		f = [d[0] - c[0], d[1] - c[1]]
		b = [f[0] * cos - sin * f[1] + c[0], sin * f[0] + cos * f[1] + c[1]]
		a.insert(ind, c)
		a.insert(ind + 1, b)
		a.insert(ind + 2, d)
		ind = ind + 4
N = int(input())
x = [[0, 0], [100, 0]]
for i in range(N):
	hura(x)
for i in range(len(x)):
	print(x[i][0], end='')
	print(' ', end='')
	print(x[i][1])


import sys
sys.setrecursionlimit(10000000)
MOD = 10 ** 9 + 7
INF = 10 ** 15
N = int(input())
ans = []
const = 2 * 3 ** 0.5

def korch_curve(Lx, Ly, Rx, Ry, i):
	if i == 0:
		ans.append((Lx, Ly))
		return
	third_y = (Ly * 2 + Ry) / 3
	third_x = (Lx * 2 + Rx) / 3
	korch_curve(Lx, Ly, third_x, third_y, i - 1)
	middle_x = (Lx + Rx) / 2 - (Ry - Ly) / const
	middle_y = (Ly + Ry) / 2 + (Rx - Lx) / const
	korch_curve(third_x, third_y, middle_x, middle_y, i - 1)
	third_second_x = (Lx + Rx * 2) / 3
	third_second_y = (Ly + Ry * 2) / 3
	korch_curve(middle_x, middle_y, third_second_x, third_second_y, i - 1)
	korch_curve(third_second_x, third_second_y, Rx, Ry, i - 1)
korch_curve(0, 0, 100, 0, N)
ans.append((100, 0))
for a in ans:
	print(*a)


from math import *
import sys
sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep='\n')

def div3(a, b):
	c1 = (2 * a + b) / 3
	c2 = (a + 2 * b) / 3
	return [c1, c2]

def main():
	n = int(input())
	xy = [[0, 0], [100, 0]]
	for _ in range(n):
		nxy = [[0, 0]]
		for ([x0, y0], [x4, y4]) in zip(xy, xy[1:]):
			(x1, x3) = div3(x0, x4)
			(y1, y3) = div3(y0, y4)
			a = ((x3 - x1) ** 2 + (y3 - y1) ** 2) ** 0.5
			rad = atan2(y3 - y1, x3 - x1)
			x2 = x1 + a * cos(rad + pi / 3)
			y2 = y1 + a * sin(rad + pi / 3)
			nxy += [[x1, y1], [x2, y2], [x3, y3], [x4, y4]]
		xy = nxy
	for (x, y) in xy:
		print(x, y)
main()


import math
N = int(input())
X = [0.0, 0.0]
Y = [100.0, 0.0]
rad = math.pi / 2 * 2 / 3

def rot(rad, pos):
	return [math.cos(rad) * pos[0] - math.sin(rad) * pos[1], math.sin(rad) * pos[0] + math.cos(rad) * pos[1]]

def coh(left, right, cnt):
	if cnt == 0:
		return
	else:
		s = [(right[0] - left[0]) / 3 + left[0], (right[1] - left[1]) / 3 + left[1]]
		t = [(right[0] - left[0]) * 2 / 3 + left[0], (right[1] - left[1]) * 2 / 3 + left[1]]
		(ux, uy) = rot(rad, [t[0] - s[0], t[1] - s[1]])
		u = [ux + s[0], uy + s[1]]
		coh(left, s, cnt - 1)
		print(*s)
		coh(s, u, cnt - 1)
		print(*u)
		coh(u, t, cnt - 1)
		print(*t)
		coh(t, right, cnt - 1)
print(*X)
coh(X, Y, N)
print(*Y)


import math
n = int(input())

def koch(d, p1, p2):
	if d == 0:
		return
	s = [(2 * p1[0] + 1 * p2[0]) / 3, (2 * p1[1] + 1 * p2[1]) / 3]
	t = [(1 * p1[0] + 2 * p2[0]) / 3, (1 * p1[1] + 2 * p2[1]) / 3]
	u = [(t[0] - s[0]) * math.cos(math.radians(60)) - (t[1] - s[1]) * math.sin(math.radians(60)) + s[0], (t[0] - s[0]) * math.sin(math.radians(60)) + (t[1] - s[1]) * math.cos(math.radians(60)) + s[1]]
	koch(d - 1, p1, s)
	print(*s)
	koch(d - 1, s, u)
	print(*u)
	koch(d - 1, u, t)
	print(*t)
	koch(d - 1, t, p2)
print('0 0')
koch(n, [0, 0], [100, 0])
print('100 0')


def next_math(n):
	turn60 = 0.5 + 3 ** 0.5 * 0.5j
	n_next = [n[0]]
	for i in range(1, len(n)):
		s = (n[i - 1] * 2 + n[i]) / 3
		t = (n[i - 1] + n[i] * 2) / 3
		u = (t - s) * turn60 + s
		n_next += [s, u, t, n[i]]
	return n_next
p1 = 0 + 0j
p2 = 100 + 0j
math = [p1, p2]
n = int(input())
for i in range(n):
	math = next_math(math)
for z in math:
	print('{:.8f} {:.8f}'.format(z.real, z.imag))


import math

def kock(n, p1, p2):
	if n == 0:
		return
	sx = (2 * p1[0] + 1 * p2[0]) / 3
	sy = (2 * p1[1] + 1 * p2[1]) / 3
	s = [sx, sy]
	tx = (1 * p1[0] + 2 * p2[0]) / 3
	ty = (1 * p1[1] + 2 * p2[1]) / 3
	t = [tx, ty]
	ux = (tx - sx) * math.cos(math.radians(60)) - (ty - sy) * math.sin(math.radians(60)) + sx
	uy = (tx - sx) * math.sin(math.radians(60)) + (ty - sy) * math.cos(math.radians(60)) + sy
	u = [ux, uy]
	kock(n - 1, p1, s)
	print(' '.join(['{:.5f}'.format(i) for i in s]))
	kock(n - 1, s, u)
	print(' '.join(['{:.5f}'.format(i) for i in u]))
	kock(n - 1, u, t)
	print(' '.join(['{:.5f}'.format(i) for i in t]))
	kock(n - 1, t, p2)
n = float(input())
print('0.00000 0.00000')
kock(n, [0, 0], [100, 0])
print('100.00000 0.00000')


from math import sqrt
n = int(input())
p1 = complex(0, 0)
p2 = complex(100, 0)
phi = complex(1 / 2, sqrt(3) / 2)

def makeCurve(p1, p2, cnt):
	if cnt >= n:
		return
	s = p1 + (p2 - p1) / 3
	t = p1 + (p2 - p1) * 2 / 3
	u = (t - s) * phi + s
	makeCurve(p1, s, cnt + 1)
	print(s.real, s.imag)
	makeCurve(s, u, cnt + 1)
	print(u.real, u.imag)
	makeCurve(u, t, cnt + 1)
	print(t.real, t.imag)
	makeCurve(t, p2, cnt + 1)
print(p1.real, p1.imag)
makeCurve(p1, p2, 0)
print(p2.real, p2.imag)


import math
n = int(input())

class Coordinate:

	def __init__(self, x, y):
		self.x = x
		self.y = y

def Koch(n, p1, p2):
	if n == 0:
		return
	else:
		s = Coordinate(2 / 3 * p1.x + 1 / 3 * p2.x, 2 / 3 * p1.y + 1 / 3 * p2.y)
		u = Coordinate(1 / 3 * p1.x + 2 / 3 * p2.x, 1 / 3 * p1.y + 2 / 3 * p2.y)
		t = Coordinate(1 / 2 * (u.x - s.x) - math.sqrt(3) / 2 * (u.y - s.y) + s.x, math.sqrt(3) / 2 * (u.x - s.x) + 1 / 2 * (u.y - s.y) + s.y)
		Koch(n - 1, p1, s)
		print(str(s.x) + ' ' + str(s.y))
		Koch(n - 1, s, t)
		print(str(t.x) + ' ' + str(t.y))
		Koch(n - 1, t, u)
		print(str(u.x) + ' ' + str(u.y))
		Koch(n - 1, u, p2)
p1 = Coordinate(0, 0)
p2 = Coordinate(100, 0)
print(str(p1.x) + ' ' + str(p1.y))
Koch(n, p1, p2)
print(str(p2.x) + ' ' + str(p2.y))


def f():
	global d
	p = []
	for i in range(len(d) - 1):
		(a, b) = (d[i], d[i + 1])
		r = (b - a) / 3
		p += [a, a + r, (a + b + r * 1j * 3 ** 0.5) / 2, b - r]
	d = p + [d[-1]]
d = [0j, 100 + 0j]
for _ in [0] * int(input()):
	f()
for e in d:
	print(e.real, e.imag)


import math

def koch(n, p1, p2):
	if n == 0:
		return
	s = [0 for i in range(2)]
	t = [0 for i in range(2)]
	u = [0 for i in range(2)]
	s[0] = (2 * p1[0] + 1 * p2[0]) / 3
	s[1] = (2 * p1[1] + 1 * p2[1]) / 3
	t[0] = (1 * p1[0] + 2 * p2[0]) / 3
	t[1] = (1 * p1[1] + 2 * p2[1]) / 3
	rad = math.radians(60)
	u[0] = (t[0] - s[0]) * math.cos(rad) - (t[1] - s[1]) * math.sin(rad) + s[0]
	u[1] = (t[0] - s[0]) * math.sin(rad) + (t[1] - s[1]) * math.cos(rad) + s[1]
	koch(n - 1, p1, s)
	print(*s)
	koch(n - 1, s, u)
	print(*u)
	koch(n - 1, u, t)
	print(*t)
	koch(n - 1, t, p2)
n = int(input())
p1 = [0, 0]
p2 = [100, 0]
print(*p1)
koch(n, p1, p2)
print(*p2)


from math import pi, sin, cos

def print_p(p):
	print('{0:.8f} {1:.8f}'.format(*p))

def koch(n, p1, p2):
	if n == 0:
		return
	s = tuple(map(lambda z: (2 * z[0] + z[1]) / 3, zip(p1, p2)))
	t = tuple(map(lambda z: (z[0] + 2 * z[1]) / 3, zip(p1, p2)))
	u = ((t[0] - s[0]) * cos(60 * (pi / 180)) - (t[1] - s[1]) * sin(60 * (pi / 180)) + s[0], (t[0] - s[0]) * sin(60 * (pi / 180)) + (t[1] - s[1]) * cos(60 * (pi / 180)) + s[1])
	koch(n - 1, p1, s)
	print_p(s)
	koch(n - 1, s, u)
	print_p(u)
	koch(n - 1, u, t)
	print_p(t)
	koch(n - 1, t, p2)
n = int(input())
p1 = [0.0, 0.0]
p2 = [100.0, 0.0]
print_p(p1)
koch(n, p1, p2)
print_p(p2)


from math import sin, cos, pi

def koch_curve(d, p1, p2):
	if d == 0:
		return
	s = [None, None]
	u = [None, None]
	t = [None, None]
	s[0] = (2 * p1[0] + p2[0]) / 3
	s[1] = (2 * p1[1] + p2[1]) / 3
	t[0] = (p1[0] + 2 * p2[0]) / 3
	t[1] = (p1[1] + 2 * p2[1]) / 3
	u[0] = (t[0] - s[0]) * cos(1 / 3 * pi) - (t[1] - s[1]) * sin(1 / 3 * pi) + s[0]
	u[1] = (t[0] - s[0]) * sin(1 / 3 * pi) + (t[1] - s[1]) * cos(1 / 3 * pi) + s[1]
	koch_curve(d - 1, p1, s)
	print(s[0], s[1])
	koch_curve(d - 1, s, u)
	print(u[0], u[1])
	koch_curve(d - 1, u, t)
	print(t[0], t[1])
	koch_curve(d - 1, t, p2)
num = int(input())
print(0.0, 0.0)
koch_curve(num, [0.0, 0.0], [100.0, 0.0])
print(100.0, 0.0)


def rec(A, n):
	if n == 0:
		return A
	else:
		return rec(draw(A), n - 1)

def draw(A):
	l = []
	for i in range(len(A) - 1):
		a = (A[i + 1][0] - A[i][0]) / 3
		b = (A[i + 1][1] - A[i][1]) / 3
		u0 = (a, b)
		u60 = (a * (1 / 2) - b * (3 ** (1 / 2) / 2), a * (3 ** (1 / 2) / 2) + b * (1 / 2))
		u300 = (a * (1 / 2) + b * (3 ** (1 / 2) / 2), -a * (3 ** (1 / 2) / 2) + b * (1 / 2))
		P = (A[i][0] + u0[0], A[i][1] + u0[1])
		Q = (P[0] + u60[0], P[1] + u60[1])
		R = (Q[0] + u300[0], Q[1] + u300[1])
		l.extend([A[i], P, Q, R])
	l.append(A[-1])
	return l
n = int(input())
A = [(0.0, 0.0), (100.0, 0.0)]
B = rec(A, n)
for P in B:
	print(f'{P[0]} {P[1]}')


import math

def plot(x, y):
	print(f'{x:.8f} {y:.8f}')

def Koch(n, x1, y1, x2, y2):
	if n == 0:
		plot(x1, y1)
		return
	sx = (2 * x1 + x2) / 3
	sy = (2 * y1 + y2) / 3
	tx = (x1 + 2 * x2) / 3
	ty = (y1 + 2 * y2) / 3
	ux = (tx - sx) * (1 / 2) - (ty - sy) * (math.sqrt(3) / 2) + sx
	uy = (tx - sx) * (math.sqrt(3) / 2) + (ty - sy) * (1 / 2) + sy
	Koch(n - 1, x1, y1, sx, sy)
	Koch(n - 1, sx, sy, ux, uy)
	Koch(n - 1, ux, uy, tx, ty)
	Koch(n - 1, tx, ty, x2, y2)
n = int(input())
Koch(n, 0, 0, 100, 0)
plot(100, 0)


import math

def plot(x, y):
	print(f'{x:.8f} {y:.8f}')

def Koch(n, x1, y1, x2, y2):
	if n == 0:
		plot(x1, y1)
		return
	sx = (2 * x1 + x2) / 3
	sy = (2 * y1 + y2) / 3
	tx = (x1 + 2 * x2) / 3
	ty = (y1 + 2 * y2) / 3
	ux = (tx - sx) * (1 / 2) - (ty - sy) * (math.sqrt(3) / 2) + sx
	uy = (tx - sx) * (math.sqrt(3) / 2) + (ty - sy) * (1 / 2) + sy
	Koch(n - 1, x1, y1, sx, sy)
	Koch(n - 1, sx, sy, ux, uy)
	Koch(n - 1, ux, uy, tx, ty)
	Koch(n - 1, tx, ty, x2, y2)
n = int(input())
Koch(n, 0, 0, 100, 0)
plot(100, 0)


N = int(input())
from math import sin, cos, pi
th = pi / 3

def koch(d, p1, p2):
	if d == 0:
		return
	s = [0, 0]
	t = [0, 0]
	u = [0, 0]
	s[0] = (2 * p1[0] + p2[0]) / 3
	s[1] = (2 * p1[1] + p2[1]) / 3
	t[0] = (2 * p2[0] + p1[0]) / 3
	t[1] = (2 * p2[1] + p1[1]) / 3
	u[0] = (t[0] - s[0]) * cos(th) - (t[1] - s[1]) * sin(th) + s[0]
	u[1] = (t[0] - s[0]) * sin(th) + (t[1] - s[1]) * cos(th) + s[1]
	koch(d - 1, p1, s)
	print(*s)
	koch(d - 1, s, u)
	print(*u)
	koch(d - 1, u, t)
	print(*t)
	koch(d - 1, t, p2)
p_start = [0.0, 0.0]
p_end = [100.0, 0.0]
print(*p_start)
koch(N, p_start, p_end)
print(*p_end)


import math

def plot(x, y):
	print(f'{x:.8f} {y:.8f}')

def Koch(n, x1, y1, x2, y2):
	if n == 0:
		plot(x1, y1)
		return
	sx = (2 * x1 + x2) / 3
	sy = (2 * y1 + y2) / 3
	tx = (x1 + x2 * 2) / 3
	ty = (y1 + y2 * 2) / 3
	ux = (tx - sx) * (1 / 2) - (ty - sy) * (math.sqrt(3) / 2) + sx
	uy = (tx - sx) * (math.sqrt(3) / 2) + (ty - sy) * (1 / 2) + sy
	Koch(n - 1, x1, y1, sx, sy)
	Koch(n - 1, sx, sy, ux, uy)
	Koch(n - 1, ux, uy, tx, ty)
	Koch(n - 1, tx, ty, x2, y2)
n = int(input())
Koch(n, 0, 0, 100, 0)
plot(100, 0)


def koch(x0, y0, x1, y1, n):
	if n == 0:
		return [(x0, y0)]
	else:
		v = (y0 - y1, x1 - x0)
		m = ((x0 + x1) / 2, (y0 + y1) / 2)
		c1 = ((2 * x0 + x1) / 3, (2 * y0 + y1) / 3)
		c2x = m[0] + v[0] / (2 * 3 ** (1 / 2))
		c2y = m[1] + v[1] / (2 * 3 ** (1 / 2))
		c2 = (c2x, c2y)
		c3 = ((x0 + 2 * x1) / 3, (y0 + 2 * y1) / 3)
		return koch(x0, y0, c1[0], c1[1], n - 1) + koch(c1[0], c1[1], c2[0], c2[1], n - 1) + koch(c2[0], c2[1], c3[0], c3[1], n - 1) + koch(c3[0], c3[1], x1, y1, n - 1)

def show_vertex(x, y):
	print('%.8f %.8f' % (x, y))
N = int(input())
V = koch(0, 0, 100, 0, N) + [[100, 0]]
for (x, y) in V:
	show_vertex(x, y)


import math

def pr8(a):
	print('{:.10}'.format(a[0]), end=' ')
	print('{:.10}'.format(a[1]))

def koch(n, p1, p2):
	if n == 0:
		return
	s = [0 for i in range(2)]
	t = [0 for i in range(2)]
	u = [0 for i in range(2)]
	s[0] = (2 * p1[0] + 1 * p2[0]) / 3
	s[1] = (2 * p1[1] + 1 * p2[1]) / 3
	t[0] = (1 * p1[0] + 2 * p2[0]) / 3
	t[1] = (1 * p1[1] + 2 * p2[1]) / 3
	rad = math.radians(60)
	u[0] = (t[0] - s[0]) * math.cos(rad) - (t[1] - s[1]) * math.sin(rad) + s[0]
	u[1] = (t[0] - s[0]) * math.sin(rad) + (t[1] - s[1]) * math.cos(rad) + s[1]
	koch(n - 1, p1, s)
	print(*s)
	koch(n - 1, s, u)
	print(*u)
	koch(n - 1, u, t)
	print(*t)
	koch(n - 1, t, p2)
n = int(input())
p1 = [0, 0]
p2 = [100, 0]
print(*p1)
koch(n, p1, p2)
print(*p2)


import math
n = int(input())

def koch(n, x_0, y_0, x_1, y_1):
	if n == 0:
		return
	x_m1 = x_0 + (x_1 - x_0) / 3
	y_m1 = y_0 + (y_1 - y_0) / 3
	x_m2 = x_0 + (x_1 - x_0) * 2 / 3
	y_m2 = y_0 + (y_1 - y_0) * 2 / 3
	x_m = (x_m2 - x_m1) * math.cos(math.pi / 3) - (y_m2 - y_m1) * math.sin(math.pi / 3) + x_m1
	y_m = (x_m2 - x_m1) * math.sin(math.pi / 3) + (y_m2 - y_m1) * math.cos(math.pi / 3) + y_m1
	koch(n - 1, x_0, y_0, x_m1, y_m1)
	print(x_m1, y_m1)
	koch(n - 1, x_m1, y_m1, x_m, y_m)
	print(x_m, y_m)
	koch(n - 1, x_m, y_m, x_m2, y_m2)
	print(x_m2, y_m2)
	koch(n - 1, x_m2, y_m2, x_1, y_1)
print(0, 0)
koch(n, 0, 0, 100, 0)
print(100, 0)


import math
n = int(input())

def plot(x, y):
	print(f'{x:.8f} {y:.8f}')

def kock(n, x1, y1, x2, y2):
	if n == 0:
		plot(x1, y1)
		return
	sx = (2 * x1 + x2) / 3
	sy = (2 * y1 + y2) / 3
	tx = (x1 + 2 * x2) / 3
	ty = (y1 + 2 * y2) / 3
	ux = (tx - sx) * (1 / 2) - (ty - sy) * (math.sqrt(3) / 2) + sx
	uy = (tx - sx) * (math.sqrt(3) / 2) + (ty - sy) * (1 / 2) + sy
	kock(n - 1, x1, y1, sx, sy)
	kock(n - 1, sx, sy, ux, uy)
	kock(n - 1, ux, uy, tx, ty)
	kock(n - 1, tx, ty, x2, y2)
kock(n, 0, 0, 100, 0)
plot(100, 0)


import cmath

def koch(n, p1, p2):
	if not n:
		return None
	s = (2 * p1 + p2) / 3
	t = (p1 + 2 * p2) / 3
	u = s + cmath.rect(1, cmath.pi / 3) * (t - s)
	koch(n - 1, p1, s)
	print(s.real, s.imag)
	koch(n - 1, s, u)
	print(u.real, u.imag)
	koch(n - 1, u, t)
	print(t.real, t.imag)
	koch(n - 1, t, p2)
(p1, p2) = (0j, 100 + 0j)
print(p1.real, p1.imag)
koch(int(input()), p1, p2)
print(p2.real, p2.imag)


import sys
import math

def koch(p1, p2):
	d = ((p2[0] - p1[0]) / 3, (p2[1] - p1[1]) / 3)
	s = (p1[0] + d[0], p1[1] + d[1])
	t = (p1[0] + d[0] * 2, p1[1] + d[1] * 2)
	u = (s[0] + 1 / 2 * d[0] - math.sqrt(3) / 2 * d[1], s[1] + math.sqrt(3) / 2 * d[0] + 1 / 2 * d[1])
	return [p1, s, u, t]
ps = [(0, 0), (100, 0)]
n = int(sys.stdin.readline())
for _ in range(n):
	points = []
	for i in range(len(ps) - 1):
		points += koch(ps[i], ps[i + 1])
	points += [ps[-1]]
	ps = points
for p in ps:
	print(' '.join(('{0:.8f}'.format(x) for x in p)))


import math

def plot(x, y):
	print(f'{x:.8f} {y:.8f}')

def Koch(n, x1, y1, x2, y2):
	if n == 0:
		plot(x1, y1)
		return
	sx = (2 * x1 + x2) / 3
	sy = (2 * y1 + y2) / 3
	tx = (x1 + 2 * x2) / 3
	ty = (y1 + 2 * y2) / 3
	ux = (tx - sx) * (1 / 2) - (ty - sy) * (math.sqrt(3) / 2) + sx
	uy = (ty - sy) * (1 / 2) + (tx - sx) * (math.sqrt(3) / 2) + sy
	Koch(n - 1, x1, y1, sx, sy)
	Koch(n - 1, sx, sy, ux, uy)
	Koch(n - 1, ux, uy, tx, ty)
	Koch(n - 1, tx, ty, x2, y2)
n = int(input())
Koch(n, 0, 0, 100, 0)
plot(100, 0)


import math
n = int(input())
p1 = (0, 0)
p2 = (100, 0)
points = []

def koch(n, p, q):
	if n == 0:
		return
	(x1, y1) = p
	(x2, y2) = q
	sx = (2 * x1 + 1 * x2) / 3
	sy = (2 * y1 + 1 * y2) / 3
	s = (sx, sy)
	tx = (1 * x1 + 2 * x2) / 3
	ty = (1 * y1 + 2 * y2) / 3
	t = (tx, ty)
	theta = math.pi / 3
	ux = (tx - sx) * math.cos(theta) - (ty - sy) * math.sin(theta) + sx
	uy = (tx - sx) * math.sin(theta) + (ty - sy) * math.cos(theta) + sy
	u = (ux, uy)
	koch(n - 1, p, s)
	print(*s)
	koch(n - 1, s, u)
	print(*u)
	koch(n - 1, u, t)
	print(*t)
	koch(n - 1, t, q)
print(*p1)
koch(n, p1, p2)
print(*p2)


import math

def plot(x, y):
	print(f'{x:.8f} {y:.8f}')

def koch(n, x1, y1, x2, y2):
	if n == 0:
		plot(x1, y1)
		return
	sx = (2 * x1 + x2) / 3
	sy = (2 * y1 + y2) / 3
	tx = (x1 + 2 * x2) / 3
	ty = (y1 + 2 * y2) / 3
	ux = (tx - sx) * math.cos(math.radians(60)) - (ty - sy) * math.sin(math.radians(60)) + sx
	uy = (tx - sx) * math.sin(math.radians(60)) + (ty - sy) * math.cos(math.radians(60)) + sy
	koch(n - 1, x1, y1, sx, sy)
	koch(n - 1, sx, sy, ux, uy)
	koch(n - 1, ux, uy, tx, ty)
	koch(n - 1, tx, ty, x2, y2)
n = int(input())
koch(n, 0, 0, 100, 0)
plot(100, 0)


import math

def koch(n, p1, p2):
	if n == 0:
		return
	sx = 2 * p1[0] / 3 + p2[0] / 3
	sy = 2 * p1[1] / 3 + p2[1] / 3
	tx = p1[0] / 3 + 2 * p2[0] / 3
	ty = p1[1] / 3 + 2 * p2[1] / 3
	ux = (tx - sx) * math.cos(math.radians(60)) - (ty - sy) * math.sin(math.radians(60)) + sx
	uy = (tx - sx) * math.sin(math.radians(60)) + (ty - sy) * math.cos(math.radians(60)) + sy
	koch(n - 1, p1, [sx, sy])
	print(sx, sy)
	koch(n - 1, [sx, sy], [ux, uy])
	print(ux, uy)
	koch(n - 1, [ux, uy], [tx, ty])
	print(tx, ty)
	koch(n - 1, [tx, ty], p2)
n = int(input())
p1 = [0, 0]
p2 = [100, 0]
print(p1[0], p1[1])
koch(n, p1, p2)
print(p2[0], p2[1])


import math

def kock(n, p1, p2):
	if n == 0:
		return
	s = [(2 * p1[0] + p2[0]) / 3, (2 * p1[1] + p2[1]) / 3]
	t = [(p1[0] + 2 * p2[0]) / 3, (p1[1] + 2 * p2[1]) / 3]
	kock(n - 1, p1, s)
	print(*s)
	u = [(t[0] - s[0]) * math.cos(math.radians(60)) - (t[1] - s[1]) * math.sin(math.radians(60)) + s[0], (t[0] - s[0]) * math.sin(math.radians(60)) + (t[1] - s[1]) * math.cos(math.radians(60)) + s[1]]
	kock(n - 1, s, u)
	print(*u)
	kock(n - 1, u, t)
	print(*t)
	kock(n - 1, t, p2)
n = int(input())
p1 = [0, 0]
p2 = [100, 0]
print(*p1)
kock(n, p1, p2)
print(*p2)


import math
n = int(input())
edge_s = (0.0, 0.0)
edge_e = (100.0, 0.0)

def print_tuple(tup):
	print('%.8f %.8f' % (tup[0], tup[1]))

def koch(start, end, n):
	if n == 0:
		return
	s = ((2 * start[0] + end[0]) / 3, (2 * start[1] + end[1]) / 3)
	t = ((start[0] + 2 * end[0]) / 3, (start[1] + 2 * end[1]) / 3)
	u = (s[0] + (t[0] - s[0]) * math.cos(math.pi / 3) - (t[1] - s[1]) * math.sin(math.pi / 3), s[1] + (t[0] - s[0]) * math.sin(math.pi / 3) + (t[1] - s[1]) * math.cos(math.pi / 3))
	n -= 1
	koch(start, s, n)
	print_tuple(s)
	koch(s, u, n)
	print_tuple(u)
	koch(u, t, n)
	print_tuple(t)
	koch(t, end, n)
print_tuple(edge_s)
koch(edge_s, edge_e, n)
print_tuple(edge_e)


from sys import stdin
from math import sin, cos, pi

def kock(n, p1, p2):
	if n != 0:
		s = ((2.0 * p1[0] + p2[0]) / 3.0, (2.0 * p1[1] + p2[1]) / 3.0)
		t = ((p1[0] + 2.0 * p2[0]) / 3.0, (p1[1] + 2.0 * p2[1]) / 3.0)
		u_x = (t[0] - s[0]) * cos(pi / 3.0) - (t[1] - s[1]) * sin(pi / 3.0) + s[0]
		u_y = (t[0] - s[0]) * sin(pi / 3.0) + (t[1] - s[1]) * cos(pi / 3.0) + s[1]
		u = (u_x, u_y)
		kock(n - 1, p1, s)
		print(*s)
		kock(n - 1, s, u)
		print(*u)
		kock(n - 1, u, t)
		print(*t)
		kock(n - 1, t, p2)
n = int(stdin.readline().rstrip())
p1 = (0.0, 0.0)
p2 = (100.0, 0.0)
print(*p1)
kock(n, p1, p2)
print(*p2)


import math
cos = math.cos(math.radians(60))
sin = math.sin(math.radians(60))

def koch(count, p1x, p1y, p2x, p2y):
	global cos
	global sin
	if count == 0:
		return
	(sx, sy) = ((2 * p1x + p2x) / 3, (2 * p1y + p2y) / 3)
	(tx, ty) = ((p1x + 2 * p2x) / 3, (p1y + 2 * p2y) / 3)
	(ux, uy) = (cos * (sx + tx) - sin * (ty - sy), sin * (tx - sx) + cos * (sy + ty))
	koch(count - 1, p1x, p1y, sx, sy)
	print(sx, sy)
	koch(count - 1, sx, sy, ux, uy)
	print(ux, uy)
	koch(count - 1, ux, uy, tx, ty)
	print(tx, ty)
	koch(count - 1, tx, ty, p2x, p2y)
n = int(input())
print(0, 0)
koch(n, 0, 0, 100, 0)
print(100, 0)


import math
c = math.cos(math.radians(60))
s = math.sin(math.radians(60))

def koch(d, p1, p2):
	if d == 0:
		return
	sx = (2 * p1[0] + p2[0]) / 3
	sy = (2 * p1[1] + p2[1]) / 3
	tx = (p1[0] + p2[0] * 2) / 3
	ty = (p1[1] + p2[1] * 2) / 3
	dx = tx - sx
	dy = ty - sy
	ux = dx * c - dy * s + sx
	uy = dx * s + dy * c + sy
	koch(d - 1, p1, (sx, sy))
	print('{0:.8f} {1:.8f}'.format(sx, sy))
	koch(d - 1, (sx, sy), (ux, uy))
	print('{0:.8f} {1:.8f}'.format(ux, uy))
	koch(d - 1, (ux, uy), (tx, ty))
	print('{0:.8f} {1:.8f}'.format(tx, ty))
	koch(d - 1, (tx, ty), p2)
n = int(input())
print('{0:.8f} {1:.8f}'.format(0, 0))
koch(n, (0, 0), (100, 0))
print('{0:.8f} {1:.8f}'.format(100, 0))


from collections import namedtuple
import math
Co = namedtuple('Co', 'x y')

def f(i, n, l, r):
	if i >= n:
		return
	il = Co(x=1 / 3 * r.x + (1 - 1 / 3) * l.x, y=1 / 3 * r.y + (1 - 1 / 3) * l.y)
	ir = Co(x=2 / 3 * r.x + (1 - 2 / 3) * l.x, y=2 / 3 * r.y + (1 - 2 / 3) * l.y)
	trix = 1 / 2 * (ir.x + il.x - math.sqrt(3) * ir.y + math.sqrt(3) * il.y)
	triy = 1 / 2 * (math.sqrt(3) * ir.x - math.sqrt(3) * il.x + ir.y + il.y)
	trico = Co(trix, triy)
	f(i + 1, n, l, il)
	print(il.x, il.y)
	f(i + 1, n, il, trico)
	print(trico.x, trico.y)
	f(i + 1, n, trico, ir)
	print(ir.x, ir.y)
	f(i + 1, n, ir, r)
n = int(input())
print(0, 0)
f(0, n, Co(0, 0), Co(100, 0))
print(100, 0)


n = int(input())
r3 = 3 ** 0.5
A = (0.0, 0.0)
B = (100.0, 0.0)

def koch(n, A, B):
	if n == 0:
		return
	C1 = ((2 * A[0] + B[0]) / 3, (2 * A[1] + B[1]) / 3)
	C3 = ((A[0] + 2 * B[0]) / 3, (A[1] + 2 * B[1]) / 3)
	(X, Y) = (C3[0] - C1[0], C3[1] - C1[1])
	C2 = (C1[0] + (X - Y * r3) / 2, C1[1] + (X * r3 + Y) / 2)
	koch(n - 1, A, C1)
	print('{:.5f} {:.5f}'.format(C1[0], C1[1]))
	koch(n - 1, C1, C2)
	print('{:.5f} {:.5f}'.format(C2[0], C2[1]))
	koch(n - 1, C2, C3)
	print('{:.5f} {:.5f}'.format(C3[0], C3[1]))
	koch(n - 1, C3, B)
print('{:.5f} {:.5f}'.format(A[0], A[1]))
koch(n, A, B)
print('{:.5f} {:.5f}'.format(B[0], B[1]))


import math

def koch(a, p1, p2):
	if a == 0:
		return
	v = [p2[0] - p1[0], p2[1] - p1[1]]
	s = [p1[0] + v[0] / 3, p1[1] + v[1] / 3]
	t = [p1[0] + 2 * v[0] / 3, p1[1] + 2 * v[1] / 3]
	u = [p1[0] + v[0] / 2 - v[1] * math.sqrt(3) / 6, p1[1] + v[1] / 2 + v[0] * math.sqrt(3) / 6]
	koch(a - 1, p1, s)
	print(' '.join(map(str, s)))
	koch(a - 1, s, u)
	print(' '.join(map(str, u)))
	koch(a - 1, u, t)
	print(' '.join(map(str, t)))
	koch(a - 1, t, p2)
n = int(input())
print('0 0')
koch(n, [0, 0], [100, 0])
print('100 0')


import math

def plot(x, y):
	print(f'{x:.8f} {y:.8f}')

def koch(n, x1, y1, x2, y2):
	if n == 0:
		plot(x1, y1)
		return
	sx = (2 * x1 + x2) / 3
	sy = (2 * y1 + y2) / 3
	tx = (x1 + 2 * x2) / 3
	ty = (y1 + 2 * y2) / 3
	ux = (tx - sx) * (1 / 2) - (ty - sy) * (math.sqrt(3) / 2) + sx
	uy = (ty - sy) * (1 / 2) + (tx - sx) * (math.sqrt(3) / 2) + sy
	koch(n - 1, x1, y1, sx, sy)
	koch(n - 1, sx, sy, ux, uy)
	koch(n - 1, ux, uy, tx, ty)
	koch(n - 1, tx, ty, x2, y2)
n = int(input())
koch(n, 0, 0, 100, 0)
plot(100, 0)


import math

def koch(n, p1, p2):
	if n == 0:
		return
	s = [(2 * p1[0] + p2[0]) / 3, (2 * p1[1] + p2[1]) / 3]
	t = [(p1[0] + 2 * p2[0]) / 3, (p1[1] + 2 * p2[1]) / 3]
	u = [(t[0] - s[0]) * math.cos(math.radians(60)) - (t[1] - s[1]) * math.sin(math.radians(60)) + s[0], (t[0] - s[0]) * math.sin(math.radians(60)) + (t[1] - s[1]) * math.cos(math.radians(60)) + s[1]]
	koch(n - 1, p1, s)
	print(s[0], s[1])
	koch(n - 1, s, u)
	print(u[0], u[1])
	koch(n - 1, u, t)
	print(t[0], t[1])
	koch(n - 1, t, p2)
n = int(input())
p1 = (0, 0)
p2 = (100, 0)
print(p1[0], p1[1])
koch(n, p1, p2)
print(p2[0], p2[1])


from math import sin, cos, radians

def c(l, p1, p2):
	l -= 1
	if l < 0:
		return
	s = ((p1[0] * 2 + p2[0]) / 3, (p1[1] * 2 + p2[1]) / 3)
	c(l, p1, s)
	print(s[0], s[1])
	t = ((p1[0] + p2[0] * 2) / 3, (p1[1] + p2[1] * 2) / 3)
	dx = t[0] - s[0]
	dy = t[1] - s[1]
	u = (dx * c60 - dy * s60 + s[0], dx * s60 + dy * c60 + s[1])
	c(l, s, u)
	print(u[0], u[1])
	c(l, u, t)
	print(t[0], t[1])
	c(l, t, p2)
r = radians(60)
s60 = sin(r)
c60 = cos(r)
print(0, 0)
c(int(input()), (0, 0), (100, 0))
print(100, 0)


import math

def kochCurve(n, p1x, p1y, p2x, p2y):
	if n == 0:
		return
	qx = 2 * p1x / 3 + p2x / 3
	qy = 2 * p1y / 3 + p2y / 3
	rx = 2 * p2x / 3 + p1x / 3
	ry = 2 * p2y / 3 + p1y / 3
	s1x = rx - qx
	s1y = ry - qy
	s2x = s1x * math.cos(math.pi / 3) - s1y * math.sin(math.pi / 3)
	s2y = s1x * math.sin(math.pi / 3) + s1y * math.cos(math.pi / 3)
	s3x = s2x + qx
	s3y = s2y + qy
	kochCurve(n - 1, p1x, p1y, qx, qy)
	print(qx, qy)
	kochCurve(n - 1, qx, qy, s3x, s3y)
	print(s3x, s3y)
	kochCurve(n - 1, s3x, s3y, rx, ry)
	print(rx, ry)
	kochCurve(n - 1, rx, ry, p2x, p2y)
n = int(input())
print(0, 0)
kochCurve(n, 0, 0, 100, 0)
print(100, 0)


n = int(input())
P = [(0.0, 0.0), (100.0, 0)]
import copy
import math
sin60 = math.sin(math.radians(60))
cos60 = math.cos(math.radians(60))
for _ in range(n):
	next_p = []
	for (p1, p2) in zip(P[:-1], P[1:]):
		l = (p1[0] * 2 / 3 + p2[0] * 1 / 3, p1[1] * 2 / 3 + p2[1] * 1 / 3)
		r = (p1[0] * 1 / 3 + p2[0] * 2 / 3, p1[1] * 1 / 3 + p2[1] * 2 / 3)
		x = cos60 * (r[0] - l[0]) - sin60 * (r[1] - l[1]) + l[0]
		y = sin60 * (r[0] - l[0]) + cos60 * (r[1] - l[1]) + l[1]
		next_p.append(p1)
		next_p.append(l)
		next_p.append((x, y))
		next_p.append(r)
	next_p.append(P[-1])
	P = copy.copy(next_p)
for p in P:
	print(p[0], p[1])


import math
T = []

class Vect:

	def __init__(self, x, y):
		self.x = x
		self.y = y

def hoge(p, q):
	ax = q.x - p.x
	ay = q.y - p.y
	bx = ax / 2 - ay * math.sqrt(3) / 2
	by = ax * math.sqrt(3) / 2 + ay / 2
	nb = Vect(p.x + bx, p.y + by)
	return nb

def koch(p, q, n):
	if n == 0:
		T.append(p)
	else:
		s = Vect(p.x + (q.x - p.x) / 3, p.y + (q.y - p.y) / 3)
		t = Vect(p.x + 2 * (q.x - p.x) / 3, p.y + 2 * (q.y - p.y) / 3)
		u = hoge(s, t)
		koch(p, s, n - 1)
		koch(s, u, n - 1)
		koch(u, t, n - 1)
		koch(t, q, n - 1)
n = int(input())
koch(Vect(0, 0), Vect(100, 0), n)
T.append(Vect(100, 0))
for i in T:
	print('%.8f %.8f' % (i.x, i.y))


import math
n = int(input())
cos60 = math.cos(math.radians(60))
sin60 = math.sin(math.radians(60))

def koch(d, p1, p2):
	if d == 0:
		return
	s = [(2.0 * p1[0] + 1.0 * p2[0]) / 3.0, (2.0 * p1[1] + 1.0 * p2[1]) / 3.0]
	t = [(1.0 * p1[0] + 2.0 * p2[0]) / 3.0, (1.0 * p1[1] + 2.0 * p2[1]) / 3.0]
	u = [(t[0] - s[0]) * cos60 - (t[1] - s[1]) * sin60 + s[0], (t[0] - s[0]) * sin60 + (t[1] - s[1]) * cos60 + s[1]]
	koch(d - 1, p1, s)
	print(f'{s[0]} {s[1]}')
	koch(d - 1, s, u)
	print(f'{u[0]} {u[1]}')
	koch(d - 1, u, t)
	print(f'{t[0]} {t[1]}')
	koch(d - 1, t, p2)
	return
print(f'{0} {0}')
koch(n, [0, 0], [100, 0])
print(f'{100} {0}')


import math

def plot(x, y):
	print(f'{x:.8f}', '', f'{y:.8f}')

def Koch(n, x1, y1, x2, y2):
	if n == 0:
		plot(x1, y1)
		return
	sx = (2 * x1 + x2) / 3
	sy = (2 * y1 + y2) / 3
	tx = (x1 + 2 * x2) / 3
	ty = (y1 + 2 * y2) / 3
	ux = (tx - sx) * (1 / 2) - (ty - sy) * (math.sqrt(3) / 2) + sx
	uy = (tx - sx) * (math.sqrt(3) / 2) + (ty - sy) * (1 / 2) + sy
	Koch(n - 1, x1, y1, sx, sy)
	Koch(n - 1, sx, sy, ux, uy)
	Koch(n - 1, ux, uy, tx, ty)
	Koch(n - 1, tx, ty, x2, y2)
n = int(input())
Koch(n, 0, 0, 100, 0)
plot(100, 0)


import math

def plot(x, y):
	print(f'{x:8f} {y:8f}')

def Koch(n, x1, y1, x2, y2):
	if n == 0:
		plot(x1, y1)
		return
	sx = (2 * x1 + x2) / 3
	sy = (2 * y1 + y2) / 3
	tx = (x1 + 2 * x2) / 3
	ty = (y1 + 2 * y2) / 3
	ux = (tx - sx) * (1 / 2) - (ty - sy) * (math.sqrt(3) / 2) + sx
	uy = (tx - sx) * (math.sqrt(3) / 2) + (ty - sy) * (1 / 2) + sy
	Koch(n - 1, x1, y1, sx, sy)
	Koch(n - 1, sx, sy, ux, uy)
	Koch(n - 1, ux, uy, tx, ty)
	Koch(n - 1, tx, ty, x2, y2)
n = int(input())
Koch(n, 0, 0, 100, 0)
plot(100, 0)


from math import sqrt
q3 = sqrt(3)
fmt = '%.8f %.8f'

def koch(x0, y0, x1, y1, c):
	if c == n:
		return (fmt % (x0, y0),)
	xp = (x0 * 2 + x1) / 3
	yp = (y0 * 2 + y1) / 3
	xq = (x0 + x1 * 2) / 3
	yq = (y0 + y1 * 2) / 3
	dx = (x1 - x0) / 6
	dy = (y1 - y0) / 6
	xr = xp + (dx - dy * q3)
	yr = yp + (dx * q3 + dy)
	return koch(x0, y0, xp, yp, c + 1) + koch(xp, yp, xr, yr, c + 1) + koch(xr, yr, xq, yq, c + 1) + koch(xq, yq, x1, y1, c + 1)
n = int(input())
print(*koch(0, 0, 100, 0, 0) + (fmt % (100, 0),), sep='\n')


import math

def plot(x, y):
	print(f'{x:.8f} {y:.8f}')

def Koch(n, x1, y1, x2, y2):
	if n == 0:
		plot(x1, y1)
		return
	sx = (2 * x1 + x2) / 3
	sy = (2 * y1 + y2) / 3
	tx = (x1 + 2 * x2) / 3
	ty = (y1 + 2 * y2) / 3
	ux = (tx - sx) * (1 / 2) - (ty - sy) * (math.sqrt(3) / 2) + sx
	uy = (tx - sx) * (math.sqrt(3) / 2) + (ty - sy) * (1 / 2) + sy
	Koch(n - 1, x1, y1, sx, sy)
	Koch(n - 1, sx, sy, ux, uy)
	Koch(n - 1, ux, uy, tx, ty)
	Koch(n - 1, tx, ty, x2, y2)
n = int(input())
Koch(n, 0, 0, 100, 0)
plot(100, 0)


import cmath
cmp_s = cmath.rect(1 / 3, 0)
cmp_u = cmath.rect(3 ** (-1 / 2), cmath.pi / 6)
cmp_t = cmath.rect(2 / 3, 0)

def koch_curve(p1: complex, p2: complex, n):
	if n != 0:
		cmp = p2 - p1
		(s, u, t) = [p1 + cmp * c for c in (cmp_s, cmp_u, cmp_t)]
		koch_curve(p1, s, n - 1)
		print('{0:8f} {1:8f}'.format(s.real, s.imag))
		koch_curve(s, u, n - 1)
		print('{0:8f} {1:8f}'.format(u.real, u.imag))
		koch_curve(u, t, n - 1)
		print('{0:8f} {1:8f}'.format(t.real, t.imag))
		koch_curve(t, p2, n - 1)

def main():
	n = int(input())
	print('{0:8f} {1:8f}'.format(0.0, 0.0))
	koch_curve(complex(0.0, 0.0), complex(100.0, 0.0), n)
	print('{0:8f} {1:8f}'.format(100.0, 0.0))
main()


n = int(input())
p1 = [float(0), float(0)]
p2 = [float(100), float(0)]
cos = 0.5
sin = 0.866025404

def koh(d, p1, p2):
	if d == 0:
		return True
	sx = (2 * p1[0] + p2[0]) / 3
	sy = (2 * p1[1] + p2[1]) / 3
	tx = (p1[0] + 2 * p2[0]) / 3
	ty = (p1[1] + 2 * p2[1]) / 3
	ux = (tx - sx) * cos - (ty - sy) * sin + sx
	uy = (tx - sx) * sin + (ty - sy) * cos + sy
	koh(d - 1, p1, [sx, sy])
	print(sx, sy)
	koh(d - 1, [sx, sy], [ux, uy])
	print(ux, uy)
	koh(d - 1, [ux, uy], [tx, ty])
	print(tx, ty)
	koh(d - 1, [tx, ty], p2)
print(p1[0], p1[1])
koh(n, p1, p2)
print(p2[0], p2[1])


from math import cos, sin, pi

def show(p):
	print(f'{p.real:.08} {p.imag:.08}')

def rotate(p, theta):
	return p * complex(cos(theta), sin(theta))

def go(n, p1, p2):
	if n == 0:
		return
	s = (p2 - p1) / 3 + p1
	t = 2 * s - p1
	u = rotate(t - s, pi / 3) + s
	go(n - 1, p1, s)
	show(s)
	go(n - 1, s, u)
	show(u)
	go(n - 1, u, t)
	show(t)
	go(n - 1, t, p2)
p1 = complex(0, 0)
p2 = complex(100, 0)
show(p1)
go(int(input()), p1, p2)
show(p2)


from math import cos, sin, pi
n = int(input())
p1 = (0, 0)
p2 = (100, 0)
theta = pi / 3

def koch(d, p1, p2):
	if d == 0:
		return None
	sx = (2 * p1[0] + p2[0]) / 3
	sy = (2 * p1[1] + p2[1]) / 3
	tx = (p1[0] + 2 * p2[0]) / 3
	ty = (p1[1] + 2 * p2[1]) / 3
	ux = (tx - sx) * cos(theta) - (ty - sy) * sin(theta) + sx
	uy = (tx - sx) * sin(theta) + (ty - sy) * cos(theta) + sy
	koch(d - 1, p1, (sx, sy))
	print('{} {}'.format(sx, sy))
	koch(d - 1, (sx, sy), (ux, uy))
	print('{} {}'.format(ux, uy))
	koch(d - 1, (ux, uy), (tx, ty))
	print('{} {}'.format(tx, ty))
	koch(d - 1, (tx, ty), p2)
print('{} {}'.format(p1[0], p1[1]))
koch(n, p1, p2)
print('{} {}'.format(p2[0], p2[1]))


def f():
	global d
	p = []
	for i in range(len(d) - 1):
		(a, b) = (d[i], d[i + 1])
		r = (b - a) / 3
		p += [a, a + r, a + r + r * (1 + 3 ** 0.5 * 1j) / 2, b - r]
	d = p + [d[-1]]
d = [0j, 100 + 0j]
for _ in [0] * int(input()):
	f()
for e in d:
	print(e.real, e.imag)


import math
n = int(input())

def fractal(A, B):
	global a1
	global a2
	global a3
	x1 = A[0]
	y1 = A[1]
	x2 = B[0]
	y2 = B[1]
	a1 = [(2 * x1 + x2) / 3, (2 * y1 + y2) / 3]
	a3 = [(x1 + 2 * x2) / 3, (y1 + 2 * y2) / 3]
	X = a3[0] - a1[0]
	Y = a3[1] - a1[1]
	a2 = [a1[0] + X / 2 - Y * math.sqrt(3) / 2, a1[1] + X * math.sqrt(3) / 2 + Y / 2]
A = [0, 0]
B = [100, 0]
fract = [A, B]
for i in range(n):
	l = len(fract)
	f = list(fract)
	for k in range(l - 1):
		fractal(f[k], f[k + 1])
		fract.insert(4 * k + 1, a1)
		fract.insert(4 * k + 2, a2)
		fract.insert(4 * k + 3, a3)
for i in fract:
	print('{0:.6f}'.format(i[0]) + ' {0:.6f}'.format(i[1]))


N = int(input())

def solve(x1, y1, x2, y2, n):
	if n == 0:
		return print(x1, y1)
	else:
		solve(x1, y1, (2 * x1 + x2) / 3, (2 * y1 + y2) / 3, n - 1)
		solve((2 * x1 + x2) / 3, (2 * y1 + y2) / 3, (x1 + x2) / 2 + (y1 - y2) * 3 ** (1 / 2) / 6, (y1 + y2) / 2 + (x2 - x1) * 3 ** (1 / 2) / 6, n - 1)
		solve((x1 + x2) / 2 + (y1 - y2) * 3 ** (1 / 2) / 6, (y1 + y2) / 2 + (x2 - x1) * 3 ** (1 / 2) / 6, (x1 + 2 * x2) / 3, (y1 + 2 * y2) / 3, n - 1)
		solve((x1 + 2 * x2) / 3, (y1 + 2 * y2) / 3, x2, y2, n - 1)
solve(0, 0, 100, 0, N)
print(100, 0)


def koch(p1, p2):
	s = [(2 * p1[0] + p2[0]) / 3, (2 * p1[1] + p2[1]) / 3]
	t = [(p1[0] + 2 * p2[0]) / 3, (p1[1] + 2 * p2[1]) / 3]
	m = [(p1[0] + p2[0]) / 2, (p1[1] + p2[1]) / 2]
	mu = [-(p2[1] - p1[1]) * 3 ** 0.5 / 6, (p2[0] - p1[0]) * 3 ** 0.5 / 6]
	u = [m[0] + mu[0], m[1] + mu[1]]
	return [s, u, t]
ans = [[0, 0], [100, 0]]
n = int(input())
for _ in range(n):
	now = ans.copy()
	ans = []
	l = 0
	r = 1
	c = len(now)
	while r < c:
		ans.append(now[l])
		ans += koch(now[l], now[r])
		l += 1
		r += 1
	ans.append(now[l])
for p in ans:
	print(*p)


import math

def koch(k, p1, p2):
	if k == 0:
		print('{0:.8f} {1:.8f}'.format(p1[0], p1[1]))
	s = [p1[0] * 2 / 3 + p2[0] / 3, p1[1] * 2 / 3 + p2[1] / 3]
	u = [(p1[0] + p2[0]) / 2 + (p1[1] - p2[1]) * math.sqrt(3) / 6, (p1[1] + p2[1]) / 2 + (p2[0] - p1[0]) * math.sqrt(3) / 6]
	t = [p1[0] / 3 + p2[0] * 2 / 3, p1[1] / 3 + p2[1] * 2 / 3]
	if k == 1:
		print('{0:.8f} {1:.8f}'.format(p1[0], p1[1]))
		print('{0:.8f} {1:.8f}'.format(s[0], s[1]))
		print('{0:.8f} {1:.8f}'.format(u[0], u[1]))
		print('{0:.8f} {1:.8f}'.format(t[0], t[1]))
	elif k > 0:
		koch(k - 1, p1, s)
		koch(k - 1, s, u)
		koch(k - 1, u, t)
		koch(k - 1, t, p2)
	if k == n:
		print('{0:.8f} {1:.8f}'.format(p2[0], p2[1]))
n = int(input())
koch(n, [0, 0], [100, 0])


import math
pi = math.pi
n = int(input())
p1 = [0, 0]
p2 = [100, 0]

def koch(n, p1, p2):
	if n == 0:
		return
	s = [(2 * p1[0] + p2[0]) / 3, (2 * p1[1] + p2[1]) / 3]
	t = [(p1[0] + 2 * p2[0]) / 3, (p1[1] + 2 * p2[1]) / 3]
	u = [(t[0] - s[0]) * math.cos(pi / 3) - (t[1] - s[1]) * math.sin(pi / 3) + s[0], (t[0] - s[0]) * math.sin(pi / 3) + (t[1] - s[1]) * math.cos(pi / 3) + s[1]]
	koch(n - 1, p1, s)
	print(*s)
	koch(n - 1, s, u)
	print(*u)
	koch(n - 1, u, t)
	print(*t)
	koch(n - 1, t, p2)
print(*p1)
koch(n, p1, p2)
print(*p2)


from math import cos, sin, pi

class Coordinate:

	def __init__(self, x, y):
		self.x = x
		self.y = y

def kock(n, p1, p2):
	if n == 0:
		return
	s = Coordinate((2 * p1.x + p2.x) / 3, (2 * p1.y + p2.y) / 3)
	t = Coordinate((p1.x + 2 * p2.x) / 3, (p1.y + 2 * p2.y) / 3)
	ux = (t.x - s.x) * cos(pi / 3) - (t.y - s.y) * sin(pi / 3) + s.x
	uy = (t.x - s.x) * sin(pi / 3) + (t.y - s.y) * cos(pi / 3) + s.y
	u = Coordinate(ux, uy)
	kock(n - 1, p1, s)
	print('%f %f' % (s.x, s.y))
	kock(n - 1, s, u)
	print('%f %f' % (u.x, u.y))
	kock(n - 1, u, t)
	print('%f %f' % (t.x, t.y))
	kock(n - 1, t, p2)
n = int(input())
p1 = Coordinate(0, 0)
p2 = Coordinate(100, 0)
print('%f %f' % (p1.x, p2.y))
kock(n, p1, p2)
print('%f %f' % (p2.x, p2.y))


import math
n = int(input())

def koch(d, p1, p2):
	if d == 0:
		return
	s = [(2 * p1[0] + p2[0]) / 3, (2 * p1[1] + p2[1]) / 3]
	t = [(p1[0] + 2 * p2[0]) / 3, (p1[1] + 2 * p2[1]) / 3]
	u = [(t[0] - s[0]) * 0.5 - (t[1] - s[1]) * 0.866025403 + s[0], (t[0] - s[0]) * 0.866025403 + (t[1] - s[1]) * 0.5 + s[1]]
	koch(d - 1, p1, s)
	print(*s)
	koch(d - 1, s, u)
	print(*u)
	koch(d - 1, u, t)
	print(*t)
	koch(d - 1, t, p2)
print(0.0, 0.0)
koch(n, [0, 0], [100, 0])
print(100.0, 0.0)


import math

def f(n, p1, p2):
	if n == 0:
		return
	s = []
	t = []
	u = []
	s.append((2 * p1[0] + p2[0]) / 3)
	s.append((2 * p1[1] + p2[1]) / 3)
	t.append((p1[0] + 2 * p2[0]) / 3)
	t.append((p1[1] + 2 * p2[1]) / 3)
	u.append((t[0] - s[0]) * math.cos(math.radians(60)) - (t[1] - s[1]) * math.sin(math.radians(60)) + s[0])
	u.append((t[0] - s[0]) * math.sin(math.radians(60)) + (t[1] - s[1]) * math.cos(math.radians(60)) + s[1])
	f(n - 1, p1, s)
	print(s[0], s[1])
	f(n - 1, s, u)
	print(u[0], u[1])
	f(n - 1, u, t)
	print(t[0], t[1])
	f(n - 1, t, p2)
n = int(input())
p1 = [0, 0]
p2 = [100, 0]
print(p1[0], p1[1])
f(n, p1, p2)
print(p2[0], p2[1])


import math
SIN_T = math.sin(math.pi / 3)
COS_T = math.cos(math.pi / 3)

def koch(p0, p4):
	p1 = ((p0[0] * 2 + p4[0]) / 3, (p0[1] * 2 + p4[1]) / 3)
	p3 = ((p0[0] + p4[0] * 2) / 3, (p0[1] + p4[1] * 2) / 3)
	p2 = (COS_T * (p3[0] - p1[0]) + -SIN_T * (p3[1] - p1[1]) + p1[0], SIN_T * (p3[0] - p1[0]) + COS_T * (p3[1] - p1[1]) + p1[1])
	return [p1, p2, p3, p4]
n = int(input())
points = [(0, 0), (100, 0)]
for _ in [0] * n:
	_points = [points[0]]
	for (origin, dest) in zip(points, points[1:]):
		_points += koch(origin, dest)
	points = _points
for p in points:
	print(*p)


import math

class Point:

	def __init__(self, x, y):
		self.x = x
		self.y = y

def koch(n, a, b):
	if n == 0:
		return
	th = math.radians(60)
	s = Point((2 * a.x + b.x) / 3, (2 * a.y + b.y) / 3)
	t = Point((a.x + 2 * b.x) / 3, (a.y + 2 * b.y) / 3)
	u = Point((t.x - s.x) * math.cos(th) - (t.y - s.y) * math.sin(th) + s.x, (t.x - s.x) * math.sin(th) + (t.y - s.y) * math.cos(th) + s.y)
	koch(n - 1, a, s)
	print(s.x, s.y)
	koch(n - 1, s, u)
	print(u.x, u.y)
	koch(n - 1, u, t)
	print(t.x, t.y)
	koch(n - 1, t, b)
import sys
input = sys.stdin.readline
n = int(input())
a = Point(0, 0)
b = Point(100, 0)
print(a.x, a.y)
koch(n, a, b)
print(b.x, b.y)


import math

def coh(n, p1, p2, pt_list, m):
	if n > m:
		return
	(x1, y1) = p1
	(x2, y2) = p2
	(nx, ny) = (-(y2 - y1), x2 - x1)
	(xs, ys) = (x1 + (x2 - x1) / 3, y1 + (y2 - y1) / 3)
	(xu, yu) = ((x1 + x2) / 2 + nx * math.sqrt(3) / 2 / 3, (y1 + y2) / 2 + ny * math.sqrt(3) / 2 / 3)
	(xt, yt) = (x1 + (x2 - x1) * 2 / 3, y1 + (y2 - y1) * 2 / 3)
	ps = (xs, ys)
	pu = (xu, yu)
	pt = (xt, yt)
	coh(n + 1, p1, ps, pt_list, m)
	pt_list += [ps]
	coh(n + 1, ps, pu, pt_list, m)
	pt_list += [pu]
	coh(n + 1, pu, pt, pt_list, m)
	pt_list += [pt]
	coh(n + 1, pt, p2, pt_list, m)
m = int(input())
pt_list = [(0, 0)]
coh(1, (0, 0), (100, 0), pt_list, m)
pt_list += [(100, 0)]
for xy in pt_list:
	print('%.9f %.9f' % (xy[0], xy[1]))


import math

def KochCurve(p1, p2, n):
	if n == 0:
		return
	s = [(2 * p1[0] + p2[0]) / 3, (2 * p1[1] + p2[1]) / 3]
	t = [(p1[0] + 2 * p2[0]) / 3, (p1[1] + 2 * p2[1]) / 3]
	u = [(p1[0] + p2[0]) / 2 + -1 * math.sqrt(3) * (p2[1] - p1[1]) / 6, (p1[1] + p2[1]) / 2 + math.sqrt(3) * (p2[0] - p1[0]) / 6]
	KochCurve(p1, s, n - 1)
	print(f"{'{:.9f}'.format(s[0])} {'{:.9f}'.format(s[1])}")
	KochCurve(s, u, n - 1)
	print(f"{'{:.9f}'.format(u[0])} {'{:.9f}'.format(u[1])}")
	KochCurve(u, t, n - 1)
	print(f"{'{:.9f}'.format(t[0])} {'{:.9f}'.format(t[1])}")
	KochCurve(t, p2, n - 1)
p1 = [0, 0]
p2 = [100, 0]
n = int(input())
print(f"{'{:.9f}'.format(p1[0])} {'{:.9f}'.format(p1[1])}")
KochCurve(p1, p2, n)
print(f"{'{:.9f}'.format(p2[0])} {'{:.9f}'.format(p2[1])}")


import math
n = int(input())

def koch(n, p1_x, p2_x, p1_y, p2_y):
	if n == 0:
		return
	s_x = (2 * p1_x + p2_x) / 3
	s_y = (2 * p1_y + p2_y) / 3
	t_x = (p1_x + 2 * p2_x) / 3
	t_y = (p1_y + 2 * p2_y) / 3
	u_x = (t_x - s_x) / 2 - (t_y - s_y) * math.sqrt(3) / 2 + s_x
	u_y = (t_x - s_x) * math.sqrt(3) / 2 + (t_y - s_y) / 2 + s_y
	koch(n - 1, p1_x, s_x, p1_y, s_y)
	print(s_x, s_y)
	koch(n - 1, s_x, u_x, s_y, u_y)
	print(u_x, u_y)
	koch(n - 1, u_x, t_x, u_y, t_y)
	print(t_x, t_y)
	koch(n - 1, t_x, p2_x, t_y, p2_y)
p1_x = 0.0
p1_y = 0.0
p2_x = 100.0
p2_y = 0.0
print(p1_x, p1_y)
koch(n, 0, 100, 0, 0)
print(p2_x, p2_y)


import math

def koch(n, p1x, p1y, p2x, p2y):
	if n == 0:
		return
	sx = (2 * p1x + 1 * p2x) / 3
	sy = (2 * p1y + 1 * p2y) / 3
	tx = (1 * p1x + 2 * p2x) / 3
	ty = (1 * p1y + 2 * p2y) / 3
	theta = math.pi / 3
	ux = math.cos(theta) * (tx - sx) - math.sin(theta) * (ty - sy) + sx
	uy = math.sin(theta) * (tx - sx) + math.cos(theta) * (ty - sy) + sy
	koch(n - 1, p1x, p1y, sx, sy)
	print('{:.5f} {:.5f}'.format(sx, sy))
	koch(n - 1, sx, sy, ux, uy)
	print('{:.5f} {:.5f}'.format(ux, uy))
	koch(n - 1, ux, uy, tx, ty)
	print('{:.5f} {:.5f}'.format(tx, ty))
	koch(n - 1, tx, ty, p2x, p2y)
n = int(input())
(p1x, p1y) = (0.0, 0.0)
(p2x, p2y) = (100.0, 0.0)
print('{:.5f} {:.5f}'.format(p1x, p1y))
koch(n, p1x, p1y, p2x, p2y)
print('{:.5f} {:.5f}'.format(p2x, p2y))


import math

def koch(n, p1, p2):
	if n == 0:
		return
	sx = (2 * p1[0] + p2[0]) / 3
	sy = (2 * p1[1] + p2[1]) / 3
	s = [sx, sy]
	tx = (p1[0] + 2 * p2[0]) / 3
	ty = (p1[1] + 2 * p2[1]) / 3
	t = [tx, ty]
	ux = (t[0] - s[0]) * 0.5 - (t[1] - s[1]) * math.sin(math.radians(60)) + s[0]
	uy = (t[0] - s[0]) * math.sin(math.radians(60)) + (t[1] - s[1]) * 0.5 + s[1]
	u = [ux, uy]
	koch(n - 1, p1, s)
	print(s[0], ' ', s[1])
	koch(n - 1, s, u)
	print(u[0], ' ', u[1])
	koch(n - 1, u, t)
	print(t[0], ' ', t[1])
	koch(n - 1, t, p2)
n = int(input())
p1 = [0, 0]
p2 = [100, 0]
print(p1[0], ' ', p1[1])
koch(n, p1, p2)
print(p2[0], ' ', p2[1])


import math

def rotate(x, y, theta):
	return (round(x * math.cos(theta) - 1 * y * math.sin(theta), 5), round(x * math.sin(theta) + y * math.cos(theta), 5))

def koch(p1, p2, n):
	s = (round((2 * p1[0] + p2[0]) / 3, 5), round((2 * p1[1] + p2[1]) / 3, 5))
	t = (round((p1[0] + 2 * p2[0]) / 3, 5), round((p1[1] + 2 * p2[1]) / 3, 5))
	rotated = rotate(t[0] - s[0], t[1] - s[1], math.pi / 3)
	u = (s[0] + rotated[0], s[1] + rotated[1])
	if n == 0:
		print(round(p1[0], 5), round(p1[1], 5))
	elif n == -1:
		return None
	koch(p1, s, n - 1)
	koch(s, u, n - 1)
	koch(u, t, n - 1)
	koch(t, p2, n - 1)
n = int(input())
koch((0.0, 0.0), (100, 0.0), n)
print(100, 0.0)


import math

class Point:

	def __init__(self, x, y):
		self.x = x
		self.y = y

	def __repr__(self):
		return '%.8f %.8f' % (self.x, self.y)

def koch(d, a, b):
	th = math.pi * 60.0 / 180.0
	if d == 0:
		return 0
	else:
		s = Point((2 * a.x + b.x) / 3.0, (2 * a.y + b.y) / 3.0)
		t = Point((a.x + 2 * b.x) / 3.0, (a.y + 2 * b.y) / 3.0)
		u = Point((t.x - s.x) * math.cos(th) - (t.y - s.y) * math.sin(th) + s.x, (t.x - s.x) * math.sin(th) + (t.y - s.y) * math.cos(th) + s.y)
		koch(d - 1, a, s)
		print(s)
		koch(d - 1, s, u)
		print(u)
		koch(d - 1, u, t)
		print(t)
		koch(d - 1, t, b)
n = int(input())
p1 = Point(0.0, 0.0)
p2 = Point(100.0, 0.0)
print(p1)
koch(n, p1, p2)
print(p2)


import math

def rot60(s, t):
	v = t - s
	a = 1 / 2 + complex(0, math.sqrt(3) / 2)
	return v * a + s

def puts(p):
	x = p.real
	y = p.imag
	print('{real} {imaginary}'.format(real=x, imaginary=y))

def koch(p1, p2, n):
	if n == 0:
		return
	s = (p2 - p1) * (1 / 3) + p1
	t = (p2 - p1) * (2 / 3) + p1
	u = rot60(s, t)
	koch(p1, s, n - 1)
	puts(s)
	koch(s, u, n - 1)
	puts(u)
	koch(u, t, n - 1)
	puts(t)
	koch(t, p2, n - 1)
n = int(input())
s = complex(0, 0)
t = complex(100, 0)
puts(s)
koch(s, t, n)
puts(t)


import math

def k(n, p1, p2):
	if n == 0:
		return 0
	sx = 2 / 3 * p1[0] + 1 / 3 * p2[0]
	sy = 2 / 3 * p1[1] + 1 / 3 * p2[1]
	s = (sx, sy)
	tx = 1 / 3 * p1[0] + 2 / 3 * p2[0]
	ty = 1 / 3 * p1[1] + 2 / 3 * p2[1]
	t = (tx, ty)
	ux = math.cos(math.radians(60)) * (tx - sx) - math.sin(math.radians(60)) * (ty - sy) + sx
	uy = math.sin(math.radians(60)) * (tx - sx) + math.cos(math.radians(60)) * (ty - sy) + sy
	u = (ux, uy)
	k(n - 1, p1, s)
	print(*s)
	k(n - 1, s, u)
	print(*u)
	k(n - 1, u, t)
	print(*t)
	k(n - 1, t, p2)
n = int(input())
p1 = (0, 0)
p2 = (100, 0)
print(*p1)
k(n, p1, p2)
print(*p2)


import math

def kock(n, p1x, p1y, p2x, p2y):
	if n == 0:
		return
	sx = (2 * p1x + p2x) / 3.0
	sy = (2 * p1y + p2y) / 3.0
	tx = (p1x + 2 * p2x) / 3.0
	ty = (p1y + 2 * p2y) / 3.0
	ux = (tx - sx) * math.cos(math.radians(60)) - (ty - sy) * math.sin(math.radians(60)) + sx
	uy = (tx - sx) * math.sin(math.radians(60)) + (ty - sy) * math.cos(math.radians(60)) + sy
	kock(n - 1, p1x, p1y, sx, sy)
	print(sx, sy)
	kock(n - 1, sx, sy, ux, uy)
	print(ux, uy)
	kock(n - 1, ux, uy, tx, ty)
	print(tx, ty)
	kock(n - 1, tx, ty, p2x, p2y)
n = int(input())
print(0, 0)
kock(n, 0, 0, 100, 0)
print(100, 0)


import math
cos60 = math.cos(math.radians(60))
sin60 = math.sin(math.radians(60))

def kock(n, p1, p2):
	if n == 0:
		return
	s = ((p1[0] * 2 + p2[0]) / 3, (p1[1] * 2 + p2[1]) / 3)
	t = ((p1[0] + p2[0] * 2) / 3, (p1[1] + p2[1] * 2) / 3)
	u = ((t[0] - s[0]) * cos60 - (t[1] - s[1]) * sin60 + s[0], (t[0] - s[0]) * sin60 + (t[1] - s[1]) * cos60 + s[1])
	kock(n - 1, p1, s)
	print(*s)
	kock(n - 1, s, u)
	print(*u)
	kock(n - 1, u, t)
	print(*t)
	kock(n - 1, t, p2)
n = int(input())
p1 = (0.0, 0.0)
p2 = (100.0, 0.0)
print(*p1)
kock(n, p1, p2)
print(*p2)


n = int(input())
(p1, p2) = ((0, 0), (100, 0))
ans_ls = [p1, p2]

def koch(d, p1, p2):
	if d == n:
		return
	s = (2 / 3 * p1[0] + 1 / 3 * p2[0], 2 / 3 * p1[1] + 1 / 3 * p2[1])
	t = (1 / 3 * p1[0] + 2 / 3 * p2[0], 1 / 3 * p1[1] + 2 / 3 * p2[1])
	R = [[1 / 2, -3 ** (1 / 2) / 2], [3 ** (1 / 2) / 2, 1 / 2]]
	u = (R[0][0] * (t[0] - s[0]) + R[0][1] * (t[1] - s[1]) + s[0], R[1][0] * (t[0] - s[0]) + R[1][1] * (t[1] - s[1]) + s[1])
	ans_ls.extend([s, u, t])
	koch(d + 1, p1, s)
	print(*s)
	koch(d + 1, s, u)
	print(*u)
	koch(d + 1, u, t)
	print(*t)
	koch(d + 1, t, p2)
print(*p1)
koch(0, p1, p2)
print(*p2)


import math

def koch(m, p1, p2):
	if m == 0:
		return
	s = [(2 * p1[0] + p2[0]) / 3, (2 * p1[1] + p2[1]) / 3]
	t = [(p1[0] + 2 * p2[0]) / 3, (p1[1] + 2 * p2[1]) / 3]
	u = [(t[0] - s[0]) * math.cos(math.pi / 3) - (t[1] - s[1]) * math.sin(math.pi / 3) + s[0], (t[0] - s[0]) * math.sin(math.pi / 3) + (t[1] - s[1]) * math.cos(math.pi / 3) + s[1]]
	koch(m - 1, p1, s)
	print(s[0], s[1])
	koch(m - 1, s, u)
	print(u[0], u[1])
	koch(m - 1, u, t)
	print(t[0], t[1])
	koch(m - 1, t, p2)
n = int(input())
print(0, 0)
koch(n, [0, 0], [100, 0])
print(100, 0)


import math

def show_vertex(x, y):
	print('%.8f %.8f' % (x, y))

def koch(x0, y0, x1, y1, n):
	if n == 0:
		show_vertex(x0, y0)
	else:
		c1 = [x0 + (x1 - x0) / 3, y0 + (y1 - y0) / 3]
		c3 = [x0 + 2 * (x1 - x0) / 3, y0 + 2 * (y1 - y0) / 3]
		c2 = [(x0 + x1) / 2 + (y0 - y1) * math.sin(math.pi / 3) / 3, (y0 + y1) / 2 + (x1 - x0) * math.sin(math.pi / 3) / 3]
		koch(x0, y0, c1[0], c1[1], n - 1)
		koch(c1[0], c1[1], c2[0], c2[1], n - 1)
		koch(c2[0], c2[1], c3[0], c3[1], n - 1)
		koch(c3[0], c3[1], x1, y1, n - 1)
N = int(input())
koch(0, 0, 100, 0, N)
show_vertex(100, 0)


def rev(s, t):
	(xa, ya) = s
	(xb, yb) = t
	X = xb - xa
	Y = yb - ya
	return ((X - 3 ** 0.5 * Y) / 2 + xa, (Y + 3 ** 0.5 * X) / 2 + ya)

def f(n):
	print(0, 0)
	_f((0, 0), (100, 0), 0, n - 1)
	print(100, 0)

def _f(p1, p2, n, end):
	if n > end:
		return
	(xa, ya) = p1
	(xb, yb) = p2
	s = (xa + (xb - xa) / 3, ya + (yb - ya) / 3)
	t = (xa + (xb - xa) * 2 / 3, ya + (yb - ya) * 2 / 3)
	u = rev(s, t)
	_f(p1, s, n + 1, end)
	print(s[0], s[1])
	_f(s, u, n + 1, end)
	print(u[0], u[1])
	_f(u, t, n + 1, end)
	print(t[0], t[1])
	_f(t, p2, n + 1, end)

def main():
	f(int(input()))
main()


import math
th = math.pi / 3

def koch(p2, n, points):
	p1 = points[-1]
	(x, y) = (p2[0] - p1[0], p2[1] - p1[1])
	s = [p1[0] + x / 3, p1[1] + y / 3]
	t = [p1[0] + x * 2 / 3, p1[1] + y * 2 / 3]
	s0t = [t[0] - s[0], t[1] - s[1]]
	s0u = [math.cos(th) * s0t[0] - math.sin(th) * s0t[1], math.sin(th) * s0t[0] + math.cos(th) * s0t[1]]
	u = [s[0] + s0u[0], s[1] + s0u[1]]
	if n == 0:
		points.append(p2)
	else:
		koch(s, n - 1, points)
		koch(u, n - 1, points)
		koch(t, n - 1, points)
		koch(p2, n - 1, points)
n = int(input())
p1 = [0.0, 0.0]
p2 = [100.0, 0.0]
points = [p1]
koch(p2, n, points)
[print(*p) for p in points]


from math import sqrt

def koch(d, p1, p2):
	if d == 0:
		return
	v = [p2[0] - p1[0], p2[1] - p1[1]]
	s = [p1[0] + v[0] / 3, p1[1] + v[1] / 3]
	t = [p1[0] + 2 * v[0] / 3, p1[1] + 2 * v[1] / 3]
	u = [p1[0] + v[0] / 2 - v[1] * sqrt(3) / 6, p1[1] + v[1] / 2 + v[0] * sqrt(3) / 6]
	koch(d - 1, p1, s)
	print(' '.join(map(str, s)))
	koch(d - 1, s, u)
	print(' '.join(map(str, u)))
	koch(d - 1, u, t)
	print(' '.join(map(str, t)))
	koch(d - 1, t, p2)
n = int(input())
print('0 0')
koch(n, [0, 0], [100, 0])
print('100 0')


from math import sin, cos, radians
N = int(input())
p1 = (0, 0)
p2 = (100, 0)
th = radians(60)

def koch(n, a, b):
	global th
	if n == 0:
		return
	s = ((2 * a[0] + 1 * b[0]) / 3, (2 * a[1] + 1 * b[1]) / 3)
	t = ((1 * a[0] + 2 * b[0]) / 3, (1 * a[1] + 2 * b[1]) / 3)
	u = ((t[0] - s[0]) * cos(th) - (t[1] - s[1]) * sin(th) + s[0], (t[0] - s[0]) * sin(th) + (t[1] - s[1]) * cos(th) + s[1])
	koch(n - 1, a, s)
	print(*s)
	koch(n - 1, s, u)
	print(*u)
	koch(n - 1, u, t)
	print(*t)
	koch(n - 1, t, b)
print(*p1)
koch(N, p1, p2)
print(*p2)


import math
c60 = math.cos(math.radians(60))
s60 = math.sin(math.radians(60))

def koch(d, p1, p2):
	if d == 0:
		return
	sx = (p2[0] + 2 * p1[0]) / 3
	sy = (p2[1] + 2 * p1[1]) / 3
	tx = (p2[0] * 2 + p1[0]) / 3
	ty = (p2[1] * 2 + p1[1]) / 3
	ux = (tx - sx) * c60 - (ty - sy) * s60 + sx
	uy = (tx - sx) * s60 + (ty - sy) * c60 + sy
	koch(d - 1, p1, (sx, sy))
	print('{0:.5f} {1:.5f}'.format(sx, sy))
	koch(d - 1, (sx, sy), (ux, uy))
	print('{0:.5f} {1:.5f}'.format(ux, uy))
	koch(d - 1, (ux, uy), (tx, ty))
	print('{0:.5f} {1:.5f}'.format(tx, ty))
	koch(d - 1, (tx, ty), p2)
n = int(input())
print('0 0')
koch(n, (0, 0), (100, 0))
print('100 0')


from math import sin, cos, pi

def koch(d, p1, p2):
	if d == 0:
		return
	s = [None, None]
	u = [None, None]
	t = [None, None]
	s[0] = (2 * p1[0] + p2[0]) / 3
	s[1] = (2 * p1[1] + p2[1]) / 3
	t[0] = (p1[0] + 2 * p2[0]) / 3
	t[1] = (p1[1] + 2 * p2[1]) / 3
	u[0] = (t[0] - s[0]) * cos(1 / 3 * pi) - (t[1] - s[1]) * sin(1 / 3 * pi) + s[0]
	u[1] = (t[0] - s[0]) * sin(1 / 3 * pi) + (t[1] - s[1]) * cos(1 / 3 * pi) + s[1]
	koch(d - 1, p1, s)
	print(s[0], s[1])
	koch(d - 1, s, u)
	print(u[0], u[1])
	koch(d - 1, u, t)
	print(t[0], t[1])
	koch(d - 1, t, p2)
n = int(input())
a = [0, 0]
b = [100, 0]
print(a[0], a[1])
koch(n, a, b)
print(b[0], b[1])


from math import sqrt
from collections import namedtuple
Point = namedtuple('Point', 'x y')

def rot60(p):
	return Point(C60 * p.x - S60 * p.y, S60 * p.x + C60 * p.y)

def koch(n, p1, p2):
	if n == 0:
		return
	s = Point((2 * p1.x + p2.x) / 3, (2 * p1.y + p2.y) / 3)
	t = Point((p1.x + 2 * p2.x) / 3, (p1.y + 2 * p2.y) / 3)
	q = rot60(Point((p2.x - p1.x) / 3, (p2.y - p1.y) / 3))
	u = Point(s.x + q.x, s.y + q.y)
	koch(n - 1, p1, s)
	print(f.format(s.x, s.y))
	koch(n - 1, s, u)
	print(f.format(u.x, u.y))
	koch(n - 1, u, t)
	print(f.format(t.x, t.y))
	koch(n - 1, t, p2)
C60 = 1 / 2
S60 = sqrt(3) / 2
f = '{:8f} {:8f}'
n = int(input())
print(f.format(0, 0))
koch(n, Point(0, 0), Point(100, 0))
print(f.format(100, 0))


import math
n = int(input())
a = math.sin(math.radians(60))
b = math.cos(math.radians(60))

def f(n, x1, x2, y1, y2):
	if n == 0:
		return
	sx = (2 * x1 + 1 * x2) / 3
	sy = (2 * y1 + 1 * y2) / 3
	tx = (1 * x1 + 2 * x2) / 3
	ty = (1 * y1 + 2 * y2) / 3
	ux = (tx - sx) * b - (ty - sy) * a + sx
	uy = (tx - sx) * a + (ty - sy) * b + sy
	f(n - 1, x1, sx, y1, sy)
	print(sx, sy)
	f(n - 1, sx, ux, sy, uy)
	print(ux, uy)
	f(n - 1, ux, tx, uy, ty)
	print(tx, ty)
	f(n - 1, tx, x2, ty, y2)
print(0.0, 0.0)
f(n, 0, 100, 0, 0)
print(100.0, 0.0)


n = int(input())

def koch(s, t, n):
	if n == 0:
		pass
	else:
		x = (t[0] - s[0]) / 3
		y = (t[1] - s[1]) / 3
		ss = [s[0] + x, s[1] + y]
		tt = [t[0] - x, t[1] - y]
		st = [ss[0] + x / 2 - 3 ** 0.5 * y / 2, ss[1] + 3 ** 0.5 * x / 2 + y / 2]
		koch(s, ss, n - 1)
		print(ss[0], ss[1])
		koch(ss, st, n - 1)
		print(st[0], st[1])
		koch(st, tt, n - 1)
		print(tt[0], tt[1])
		koch(tt, t, n - 1)
print(0, 0)
koch([0, 0], [100, 0], n)
print(100, 0)


import math as m

def plot(x, y):
	print(f'{x:.8f} {y:.8f}')

def koch(n, x1, y1, x2, y2):
	if n == 0:
		plot(x1, y1)
		return
	sx = (2 * x1 + x2) / 3
	sy = (2 * y1 + y2) / 3
	tx = (x1 + 2 * x2) / 3
	ty = (y1 + 2 * y2) / 3
	ux = (tx - sx) * m.cos(m.radians(60)) - (ty - sy) * m.sin(m.radians(60)) + sx
	uy = (tx - sx) * m.sin(m.radians(60)) + (ty - sy) * m.cos(m.radians(60)) + sy
	koch(n - 1, x1, y1, sx, sy)
	koch(n - 1, sx, sy, ux, uy)
	koch(n - 1, ux, uy, tx, ty)
	koch(n - 1, tx, ty, x2, y2)
n = int(input())
koch(n, 0, 0, 100, 0)
plot(100, 0)


from math import sin, cos, pi

def koch(px, py, qx, qy, n):
	if n == 0:
		return True
	sx = (2 * px + qx) / 3
	sy = (2 * py + qy) / 3
	tx = (px + 2 * qx) / 3
	ty = (py + 2 * qy) / 3
	ux = sx + (tx - sx) * cos(pi / 3) - (ty - sy) * sin(pi / 3)
	uy = sy + (tx - sx) * sin(pi / 3) + (ty - sy) * cos(pi / 3)
	koch(px, py, sx, sy, n - 1)
	print('{:.8f} {:.8f}'.format(sx, sy))
	koch(sx, sy, ux, uy, n - 1)
	print('{:.8f} {:.8f}'.format(ux, uy))
	koch(ux, uy, tx, ty, n - 1)
	print('{:.8f} {:.8f}'.format(tx, ty))
	koch(tx, ty, qx, qy, n - 1)
n = int(input())
print('{:.8f} {:.8f}'.format(0, 0))
koch(0, 0, 100, 0, n)
print('{:.8f} {:.8f}'.format(100, 0))


import math
d = int(input())

class point:

	def __init__(self, arg_x, arg_y):
		self.x = arg_x
		self.y = arg_y
p1 = point(0, 0)
p2 = point(100, 0)

def koch(d, p1, p2):
	pi = math.pi
	cos60 = math.cos(pi / 3)
	sin60 = math.sin(pi / 3)
	if d == 0:
		return
	else:
		s = point((2 * p1.x + 1 * p2.x) / 3, (2 * p1.y + 1 * p2.y) / 3)
		t = point((1 * p1.x + 2 * p2.x) / 3, (1 * p1.y + 2 * p2.y) / 3)
		u = point(s.x + cos60 * (t.x - s.x) - sin60 * (t.y - s.y), s.y + sin60 * (t.x - s.x) + cos60 * (t.y - s.y))
		koch(d - 1, p1, s)
		print(s.x, s.y)
		koch(d - 1, s, u)
		print(u.x, u.y)
		koch(d - 1, u, t)
		print(t.x, t.y)
		koch(d - 1, t, p2)
print(p1.x, p1.y)
koch(d, p1, p2)
print(p2.x, p2.y)


from math import cos, sin, pi

def make_koch_curve(N, n1, n2):
	s = ((2 * n1[0] + n2[0]) / 3, (2 * n1[1] + n2[1]) / 3)
	t = ((n1[0] + 2 * n2[0]) / 3, (n1[1] + 2 * n2[1]) / 3)
	u = ((t[0] - s[0]) * cos(pi / 3) - (t[1] - s[1]) * sin(pi / 3) + s[0], (t[0] - s[0]) * sin(pi / 3) + (t[1] - s[1]) * cos(pi / 3) + s[1])
	if N == 0:
		return
	make_koch_curve(N - 1, n1, s)
	print(*s)
	make_koch_curve(N - 1, s, u)
	print(*u)
	make_koch_curve(N - 1, u, t)
	print(*t)
	make_koch_curve(N - 1, t, n2)

def main():
	N = int(input())
	n1 = (0.0, 0.0)
	n2 = (100.0, 0.0)
	print(*n1)
	make_koch_curve(N, n1, n2)
	print(*n2)
main()


from math import pi, sin, cos
count = int(input())
p1 = [0, 0]
p2 = [100, 0]

def koch(p1, p2, count):
	if count == 0:
		return
	p3 = [(2 * p1[0] + p2[0]) / 3, (2 * p1[1] + p2[1]) / 3]
	p5 = [(p1[0] + 2 * p2[0]) / 3, (p1[1] + 2 * p2[1]) / 3]
	p4 = [(p5[0] - p3[0]) * cos(pi / 3) - (p5[1] - p3[1]) * sin(pi / 3) + p3[0], (p5[0] - p3[0]) * sin(pi / 3) + (p5[1] - p3[1]) * cos(pi / 3) + p3[1]]
	koch(p1, p3, count - 1)
	print(*p3)
	koch(p3, p4, count - 1)
	print(*p4)
	koch(p4, p5, count - 1)
	print(*p5)
	koch(p5, p2, count - 1)
print(*p1)
koch(p1, p2, count)
print(*p2)


import math

class coordinate:

	def __init__(self, x, y):
		self.x = x
		self.y = y

def koch(n, p1, p2):
	if n == 0:
		return str(p2.x) + ' ' + str(p2.y)
	else:
		s = coordinate((2 * p1.x + p2.x) / 3, (2 * p1.y + p2.y) / 3)
		t = coordinate((p1.x + 2 * p2.x) / 3, (p1.y + 2 * p2.y) / 3)
		u = coordinate((t.x - s.x) / 2 - (t.y - s.y) / 2 * math.sqrt(3) + s.x, (t.x - s.x) / 2 * math.sqrt(3) + (t.y - s.y) / 2 + s.y)
		print(koch(n - 1, p1, s))
		print(koch(n - 1, s, u))
		print(koch(n - 1, u, t))
		return koch(n - 1, t, p2)
q1 = coordinate(0.0, 0.0)
q2 = coordinate(100.0, 0.0)
print(str(q1.x) + ' ' + str(q1.y))
print(koch(int(input()), q1, q2))


def f():
	global d
	p = []
	for i in range(len(d) - 1):
		(a, b) = (d[i], d[i + 1])
		s = a + (b - a) / 3
		(u, t) = (s + (s - a) * (1 + 3 ** 0.5 * 1j) / 2, b - (b - a) / 3)
		p += [a, s, u, t]
	d = p + [d[-1]]
d = [0j, 100 + 0j]
for _ in [0] * int(input()):
	f()
for e in d:
	print(e.real, e.imag)


import math

def koch(start, end, n, r):
	if n > 0:
		a = [(start[0] * 2 + end[0] * 1) / 3, (start[1] * 2 + end[1] * 1) / 3]
		c = [(start[0] * 1 + end[0] * 2) / 3, (start[1] * 1 + end[1] * 2) / 3]
		x = c[0] - a[0]
		y = c[1] - a[1]
		b = [x * math.cos(math.pi / 3) - y * math.sin(math.pi / 3) + a[0], x * math.sin(math.pi / 3) + y * math.cos(math.pi / 3) + a[1]]
		koch(start, a, n - 1, r)
		koch(a, b, n - 1, r)
		koch(b, c, n - 1, r)
		koch(c, end, n - 1, r)
	else:
		r.append(start)
n = int(input())
r = []
koch([0, 0], [100, 0], n, r)
r.append([100, 0])
for rr in r:
	print(str(rr[0]) + ' ' + str(rr[1]))


import math

def kock(n, p1x, p1y, p2x, p2y):
	if n == 0:
		pass
	else:
		sx = (2 * p1x + p2x) / 3
		sy = (2 * p1y + p2y) / 3
		tx = (p1x + 2 * p2x) / 3
		ty = (p1y + 2 * p2y) / 3
		ux = (tx - sx) * math.cos(math.pi * 1 / 3) - (ty - sy) * math.sin(math.pi * 1 / 3) + sx
		uy = (tx - sx) * math.sin(math.pi * 1 / 3) + (ty - sy) * math.cos(math.pi * 1 / 3) + sy
		kock(n - 1, p1x, p1y, sx, sy)
		print(sx, sy)
		kock(n - 1, sx, sy, ux, uy)
		print(ux, uy)
		kock(n - 1, ux, uy, tx, ty)
		print(tx, ty)
		kock(n - 1, tx, ty, p2x, p2y)
n = int(input().strip())
zero = 0.0
hundred = 100.0
print(zero, zero)
kock(n, 0, 0, 100, 0)
print(hundred, zero)


import math

def show_vertex(x, y):
	print('%.8f %.8f' % (x, y))

def koch(x0, y0, x1, y1, n):
	if n == 0:
		show_vertex(x0, y0)
	else:
		c1 = [(2 * x0 + x1) / 3, (2 * y0 + y1) / 3]
		c3 = [(x0 + 2 * x1) / 3, (y0 + 2 * y1) / 3]
		c2 = [(3 * (x1 + x0) - (y1 - y0) * math.sqrt(3)) / 6, ((x1 - x0) * math.sqrt(3) + 3 * (y1 + y0)) / 6]
		koch(x0, y0, c1[0], c1[1], n - 1)
		koch(c1[0], c1[1], c2[0], c2[1], n - 1)
		koch(c2[0], c2[1], c3[0], c3[1], n - 1)
		koch(c3[0], c3[1], x1, y1, n - 1)
N = int(input())
koch(0, 0, 100, 0, N)
show_vertex(100, 0)


import math

def plot(x, y):
	print(f'{x:.8f} {y:.8f}')

def Koch(n, x1, y1, x2, y2):
	if n == 0:
		plot(x1, y1)
		return
	sx = (2 * x1 + x2) / 3
	sy = (2 * y1 + y2) / 3
	tx = (x1 + 2 * x2) / 3
	ty = (y1 + 2 * y2) / 3
	ux = (tx - sx) * (1 / 2) - (ty - sy) * math.sqrt(3) / 2 + sx
	uy = (tx - sx) * math.sqrt(3) / 2 + (ty - sy) * (1 / 2) + sy
	Koch(n - 1, x1, y1, sx, sy)
	Koch(n - 1, sx, sy, ux, uy)
	Koch(n - 1, ux, uy, tx, ty)
	Koch(n - 1, tx, ty, x2, y2)
n = int(input())
Koch(n, 0, 0, 100, 0)
plot(100, 0)


import math

class Point:

	def __init__(self, x, y):
		self.x = x
		self.y = y

	def __repr__(self):
		return str(self.x) + ' ' + str(self.y)

def Koch(p1, p2, n):
	if n == 0:
		print(p1)
	else:
		s = Point(p1.x * 2 / 3 + p2.x * 1 / 3, p1.y * 2 / 3 + p2.y * 1 / 3)
		u = Point(p1.x / 2 + p2.x / 2 + p1.y * r3 / 6 - p2.y * r3 / 6, p1.y / 2 + p2.y / 2 + p2.x * r3 / 6 - p1.x * r3 / 6)
		t = Point(p1.x * 1 / 3 + p2.x * 2 / 3, p1.y * 1 / 3 + p2.y * 2 / 3)
		Koch(p1, s, n - 1)
		Koch(s, u, n - 1)
		Koch(u, t, n - 1)
		Koch(t, p2, n - 1)
r3 = math.sqrt(3)
start = Point(0, 0)
goal = Point(100, 0)
n = int(input())
Koch(start, goal, n)
print(goal)


import math

def koch(n, p1, p2):
	if n == 0:
		return None
	s = [(p1[0] * 2 + p2[0]) / 3, (p1[1] * 2 + p2[1]) / 3]
	t = [(p1[0] + p2[0] * 2) / 3, (p1[1] + p2[1] * 2) / 3]
	u = [(t[0] - s[0]) * math.cos(math.pi / 3) - (t[1] - s[1]) * math.sin(math.pi / 3) + s[0], (t[0] - s[0]) * math.sin(math.pi / 3) + (t[1] - s[1]) * math.cos(math.pi / 3) + s[1]]
	koch(n - 1, p1, s)
	print(f'{s[0]:.8f} {s[1]:.8f}')
	koch(n - 1, s, u)
	print(f'{u[0]:.8f} {u[1]:.8f}')
	koch(n - 1, u, t)
	print(f'{t[0]:.8f} {t[1]:.8f}')
	koch(n - 1, t, p2)
n = int(input())
print(0, 0)
koch(n, [0.0, 0.0], [100.0, 0.0])
print(100, 0)


import math
n = int(input())
p1 = (0, 0)
p2 = (100, 0)

def koch(n, p1, p2):
	if n == 0:
		return
	sx = 2 / 3 * p1[0] + 1 / 3 * p2[0]
	sy = 2 / 3 * p1[1] + 1 / 3 * p2[1]
	s = (sx, sy)
	tx = 1 / 3 * p1[0] + 2 / 3 * p2[0]
	ty = 1 / 3 * p1[1] + 2 / 3 * p2[1]
	t = (tx, ty)
	ux = math.cos(math.radians(60)) * (tx - sx) - math.sin(math.radians(60)) * (ty - sy) + sx
	uy = math.sin(math.radians(60)) * (tx - sx) + math.cos(math.radians(60)) * (ty - sy) + sy
	u = (ux, uy)
	koch(n - 1, p1, s)
	print(*s)
	koch(n - 1, s, u)
	print(*u)
	koch(n - 1, u, t)
	print(*t)
	koch(n - 1, t, p2)
print(*p1)
koch(n, p1, p2)
print(*p2)


import math
con = math.sqrt(3) / 2

def gohho(da):
	ans = []
	n = len(da)
	for i in range(n - 1):
		ans.append(da[i])
		ans.append([(da[i][0] * 2 + da[i + 1][0]) / 3, (da[i][1] * 2 + da[i + 1][1]) / 3])
		ans.append([(da[i][0] * 2 + da[i + 1][0]) / 3 + (da[i + 1][0] - da[i][0]) * 0.5 / 3 - (da[i + 1][1] - da[i][1]) * con / 3, (da[i][1] * 2 + da[i + 1][1]) / 3 + (da[i + 1][0] - da[i][0]) * con / 3 + (da[i + 1][1] - da[i][1]) * 0.5 / 3])
		ans.append([(da[i][0] + da[i + 1][0] * 2) / 3, (da[i][1] + da[i + 1][1] * 2) / 3])
	ans.append(da[-1])
	return ans
n = int(input())
da = [[0, 0], [100, 0]]
for i in range(n):
	da = gohho(da)
for i in da:
	print(i[0], i[1])


import math

def plot(x, y):
	print(f'{x:.8f} {y:.8f}')

def koch(n, x1, y1, x2, y2):
	if n == 0:
		plot(x1, y1)
		return
	sx = (2 * x1 + x2) / 3
	sy = (2 * y1 + y2) / 3
	tx = (x1 + 2 * x2) / 3
	ty = (y1 + 2 * y2) / 3
	ux = (tx - sx) * (1 / 2) - (ty - sy) * (math.sqrt(3) / 2) + sx
	uy = (tx - sx) * (math.sqrt(3) / 2) + (ty - sy) * (1 / 2) + sy
	koch(n - 1, x1, y1, sx, sy)
	koch(n - 1, sx, sy, ux, uy)
	koch(n - 1, ux, uy, tx, ty)
	koch(n - 1, tx, ty, x2, y2)
n = int(input())
koch(n, 0, 0, 100, 0)
plot(100, 0)


def f():
	global d
	p = [d[0]]
	for i in range(len(d) - 1):
		(a, b) = (d[i], d[i + 1])
		r = (b - a) / 3
		p += [a + r, a + r + r * (1 + 3 ** 0.5 * 1j) / 2, b - r, b]
	d = p
d = [0j, 100 + 0j]
for _ in [0] * int(input()):
	f()
for e in d:
	print(e.real, e.imag)


import math
cos60 = math.cos(60 / 180 * math.pi)
sin60 = math.sin(60 / 180 * math.pi)

class Point:

	def __init__(self, x, y):
		self.x = x
		self.y = y

	def __repr__(self):
		return str(self.x) + ' ' + str(self.y)

def koch(n, p1, p2):
	if n == 0:
		return
	s = Point((2 * p1.x + p2.x) / 3, (2 * p1.y + 1 * p2.y) / 3)
	t = Point((p1.x + 2 * p2.x) / 3, (p1.y + 2 * p2.y) / 3)
	u = Point((t.x - s.x) * cos60 - (t.y - s.y) * sin60 + s.x, (t.x - s.x) * sin60 + (t.y - s.y) * cos60 + s.y)
	koch(n - 1, p1, s)
	print(s)
	koch(n - 1, s, u)
	print(u)
	koch(n - 1, u, t)
	print(t)
	koch(n - 1, t, p2)
p1 = Point(0, 0)
p2 = Point(100, 0)
n = int(input())
print(p1)
koch(n, p1, p2)
print(p2)


import math

def kock(n, p1, p2):
	a = math.radians(60)
	if n == 0:
		return 0
	s = [(2 * p1[0] + p2[0]) / 3, (2 * p1[1] + p2[1]) / 3]
	t = [(p1[0] + 2 * p2[0]) / 3, (p1[1] + 2 * p2[1]) / 3]
	u = [(t[0] - s[0]) * math.cos(a) - (t[1] - s[1]) * math.sin(a) + s[0], (t[0] - s[0]) * math.sin(a) + (t[1] - s[1]) * math.cos(a) + s[1]]
	kock(n - 1, p1, s)
	print(' '.join(map(str, s)))
	kock(n - 1, s, u)
	print(' '.join(map(str, u)))
	kock(n - 1, u, t)
	print(' '.join(map(str, t)))
	kock(n - 1, t, p2)
n = int(input())
start = [float(0), float(0)]
end = [float(100), float(0)]
print(' '.join(map(str, start)))
kock(n, start, end)
print(' '.join(map(str, end)))


def next_koch(n):
	turn60 = 0.5 + 3 ** 0.5 * 0.5j
	n_next = [n[0]]
	for i in range(1, len(n)):
		s = (n[i - 1] * 2 + n[i]) / 3
		t = (n[i - 1] + n[i] * 2) / 3
		u = (t - s) * turn60 + s
		n_next += [s, u, t, n[i]]
	return n_next
p1 = 0 + 0j
p2 = 100 + 0j
koch = [p1, p2]
n = int(input())
for i in range(n):
	koch = next_koch(koch)
for z in koch:
	print('{:.8f} {:.8f}'.format(z.real, z.imag))


import math
angle = math.pi / 3

def koch(p1, p2, n):
	if n == 0:
		return
	s = ((p1[0] * 2 + p2[0]) / 3, (p1[1] * 2 + p2[1]) / 3)
	t = ((p1[0] + p2[0] * 2) / 3, (p1[1] + p2[1] * 2) / 3)
	u = ((t[0] - s[0]) * math.cos(angle) - (t[1] - s[1]) * math.sin(angle) + s[0], (t[0] - s[0]) * math.sin(angle) + (t[1] - s[1]) * math.cos(angle) + s[1])
	koch(p1, s, n - 1)
	print('{0:.8f} {1:.8f}'.format(s[0], s[1]))
	koch(s, u, n - 1)
	print('{0:.8f} {1:.8f}'.format(u[0], u[1]))
	koch(u, t, n - 1)
	print('{0:.8f} {1:.8f}'.format(t[0], t[1]))
	koch(t, p2, n - 1)
n = int(input())
print('{0:.8f} {1:.8f}'.format(0.0, 0.0))
koch((0.0, 0.0), (100.0, 0.0), n)
print('{0:.8f} {1:.8f}'.format(100.0, 0.0))


import math

def plot(x, y):
	print(f'{x:.8f} {y:.8f}')

def Koch(n, x1, y1, x2, y2):
	if n == 0:
		plot(x1, y1)
		return
	sx = (2 * x1 + x2) / 3
	sy = (2 * y1 + y2) / 3
	tx = (x1 + 2 * x2) / 3
	ty = (y1 + 2 * y2) / 3
	ux = (tx - sx) * (1 / 2) - (ty - sy) * (math.sqrt(3) / 2) + sx
	uy = (tx - sx) * (math.sqrt(3) / 2) + (ty - sy) * (1 / 2) + sy
	Koch(n - 1, x1, y1, sx, sy)
	Koch(n - 1, sx, sy, ux, uy)
	Koch(n - 1, ux, uy, tx, ty)
	Koch(n - 1, tx, ty, x2, y2)
n = int(input())
Koch(n, 0, 0, 100, 0)
plot(100, 0)


from math import cos, sin, pi
n = int(input())

def koch(n, l, r):
	if n == 0:
		return
	s = ((2 * l[0] + r[0]) / 3, (2 * l[1] + r[1]) / 3)
	t = ((l[0] + 2 * r[0]) / 3, (l[1] + 2 * r[1]) / 3)
	u = ((t[0] - s[0]) * cos(pi / 3) - (t[1] - s[1]) * sin(pi / 3) + s[0], (t[0] - s[0]) * sin(pi / 3) + (t[1] - s[1]) * cos(pi / 3) + s[1])
	koch(n - 1, l, s)
	print(s[0], s[1])
	koch(n - 1, s, u)
	print(u[0], u[1])
	koch(n - 1, u, t)
	print(t[0], t[1])
	koch(n - 1, t, r)
print(0, 0)
koch(n, (0, 0), (100, 0))
print(100, 0)


def Rot(vec):
	new = []
	new += [vec[0] / 2 - vec[1] * 3 ** (1 / 2) / 2]
	new += [vec[0] * 3 ** (1 / 2) / 2 + vec[1] / 2]
	return new

def Add(L):
	dist = [(L[1][0] - L[0][0]) / 3, (L[1][1] - L[0][1]) / 3]
	vec1 = Rot(dist)
	p1 = [2 / 3 * L[0][0] + 1 / 3 * L[1][0], 2 / 3 * L[0][1] + 1 / 3 * L[1][1]]
	p2 = [p1[0] + vec1[0], p1[1] + vec1[1]]
	p3 = [2 / 3 * L[1][0] + 1 / 3 * L[0][0], 2 / 3 * L[1][1] + 1 / 3 * L[0][1]]
	return [L[0], p1, p2, p3, L[1]]

def Koch(L, n):
	l = len(L)
	if n == 0:
		Out = L
	elif n == 1:
		if l == 2:
			Out = Add(L)
		else:
			L1 = L[0:l // 2 + 1]
			L2 = L[l // 2:l]
			Out = Koch(L1, n)[:-1] + Koch(L2, n)
	else:
		Out = Koch(Koch(L, n - 1), 1)
	return Out
n = int(input())
L = Koch([[0, 0], [100, 0]], n)
l = len(L)
for i in range(l):
	print(L[i][0], L[i][1])


n = int(input())
L = [[0, 0], [100, 0]]
for i in range(n):
	sub = []
	for j in range(len(L) - 1):
		K = []
		a = L[j][0]
		b = L[j][1]
		c = L[j + 1][0]
		d = L[j + 1][1]
		if a == 0:
			K.append([a, b])
		K.append([a + (c - a) / 3, b + (d - b) / 3])
		K.append([(a + c) / 2 + (b - d) * 3 ** 0.5 / 6, (b + d) / 2 + (c - a) * 3 ** 0.5 / 6])
		K.append([a + (c - a) * 2 / 3, b + (d - b) * 2 / 3])
		K.append([c, d])
		sub = sub + K
	L = sub
for i in range(len(L)):
	print(L[i][0], L[i][1])


import math

def kock(n, p1, p2):
	if n == 0:
		return
	s = ((p1[0] * 2 + p2[0]) / 3, (p1[1] * 2 + p2[1]) / 3)
	t = ((p1[0] + p2[0] * 2) / 3, (p1[1] + p2[1] * 2) / 3)
	rad60 = math.radians(60)
	sin60 = math.sin(rad60)
	cos60 = math.cos(rad60)
	ux = (t[0] - s[0]) * cos60 - (t[1] - s[1]) * sin60 + s[0]
	uy = (t[0] - s[0]) * sin60 + (t[1] - s[1]) * cos60 + s[1]
	u = (ux, uy)
	kock(n - 1, p1, s)
	print(*s)
	kock(n - 1, s, u)
	print(*u)
	kock(n - 1, u, t)
	print(*t)
	kock(n - 1, t, p2)
n = int(input())
p1 = (0, 0)
p2 = (100, 0)
print(*p1)
kock(n, p1, p2)
print(*p2)


d = [0j, 100 + 0j]
for _ in [0] * int(input()):
	p = [d[0]]
	for i in range(len(d) - 1):
		(a, b) = (d[i], d[i + 1])
		r = (b - a) / 3
		p += [a + r, a + r + r * (1 + 3 ** 0.5 * 1j) / 2, b - r, b]
	d = p
for e in d:
	print(e.real, e.imag)


import math

def koch(left, right, n):
	if n < 1:
		print(' '.join(map(str, left)))
		return
	(s, t, u) = ([0] * 2, [0] * 2, [0] * 2)
	s[0] = (2 * left[0] + right[0]) / 3.0
	s[1] = (2 * left[1] + right[1]) / 3.0
	t[0] = (left[0] + 2 * right[0]) / 3.0
	t[1] = (left[1] + 2 * right[1]) / 3.0
	u[0] = (t[0] - s[0]) * math.cos(math.pi / 3) - (t[1] - s[1]) * math.sin(math.pi / 3) + s[0]
	u[1] = (t[0] - s[0]) * math.sin(math.pi / 3) + (t[1] - s[1]) * math.cos(math.pi / 3) + s[1]
	koch(left, s, n - 1)
	koch(s, u, n - 1)
	koch(u, t, n - 1)
	koch(t, right, n - 1)
n = int(input())
left = [0, 0]
right = [100, 0]
koch(left, right, n)
print(right[0], right[1])


import math
pi = math.pi
n = int(input())
p1 = [0, 0]
p2 = [100, 0]

def koch(n, p1, p2):
	if n == 0:
		return
	s = [(2 * p1[0] + p2[0]) / 3.0, (2 * p1[1] + p2[1]) / 3.0]
	t = [(1 * p1[0] + 2 * p2[0]) / 3.0, (p1[1] + 2 * p2[1]) / 3.0]
	u = [(t[0] - s[0]) * math.cos(pi / 3) - (t[1] - s[1]) * math.sin(pi / 3) + s[0], (t[0] - s[0]) * math.sin(pi / 3) + (t[1] - s[1]) * math.cos(pi / 3) + s[1]]
	koch(n - 1, p1, s)
	print(*s)
	koch(n - 1, s, u)
	print(*u)
	koch(n - 1, u, t)
	print(*t)
	koch(n - 1, t, p2)
print(*p1)
koch(n, p1, p2)
print(*p2)


import math

def plot(x, y):
	print(f'{x:8f} {y:8f}')

def koch(n, x1, y1, x2, y2):
	if n == 0:
		plot(x1, y1)
		return
	sx = (2 * x1 + x2) / 3
	sy = (2 * y1 + y2) / 3
	tx = (x1 + 2 * x2) / 3
	ty = (y1 + 2 * y2) / 3
	ux = (tx - sx) * (1 / 2) - (ty - sy) * (math.sqrt(3) / 2) + sx
	uy = (tx - sx) * (math.sqrt(3) / 2) + (ty - sy) * (1 / 2) + sy
	koch(n - 1, x1, y1, sx, sy)
	koch(n - 1, sx, sy, ux, uy)
	koch(n - 1, ux, uy, tx, ty)
	koch(n - 1, tx, ty, x2, y2)
n = int(input())
koch(n, 0, 0, 100, 0)
plot(100, 0)


import math

def plot(x, y):
	print(f'{x:.8f} {y:.8f}')

def Koch(n, x1, y1, x2, y2):
	if n == 0:
		plot(x1, y1)
		return
	sx = (2 * x1 + x2) / 3
	sy = (2 * y1 + y2) / 3
	tx = (x1 + 2 * x2) / 3
	ty = (y1 + 2 * y2) / 3
	ux = (tx - sx) * (1 / 2) - (ty - sy) * (math.sqrt(3) / 2) + sx
	uy = (tx - sx) * (math.sqrt(3) / 2) + sy + (ty - sy) * (1 / 2)
	Koch(n - 1, x1, y1, sx, sy)
	Koch(n - 1, sx, sy, ux, uy)
	Koch(n - 1, ux, uy, tx, ty)
	Koch(n - 1, tx, ty, x2, y2)
n = int(input())
Koch(n, 0, 0, 100, 0)
plot(100, 0)


import math

def kochCurve(d, p1, p2):
	if d <= 0:
		return
	s = [(2.0 * p1[0] + 1.0 * p2[0]) / 3.0, (2.0 * p1[1] + 1.0 * p2[1]) / 3.0]
	t = [(1.0 * p1[0] + 2.0 * p2[0]) / 3.0, (1.0 * p1[1] + 2.0 * p2[1]) / 3.0]
	u = [(t[0] - s[0]) * math.cos(math.radians(60)) - (t[1] - s[1]) * math.sin(math.radians(60)) + s[0], (t[0] - s[0]) * math.sin(math.radians(60)) + (t[1] - s[1]) * math.cos(math.radians(60)) + s[1]]
	kochCurve(d - 1, p1, s)
	print(s[0], s[1])
	kochCurve(d - 1, s, u)
	print(u[0], u[1])
	kochCurve(d - 1, u, t)
	print(t[0], t[1])
	kochCurve(d - 1, t, p2)
n = int(input())
s = [0.0, 0.0]
e = [100.0, 0.0]
print(s[0], s[1])
if n != 0:
	kochCurve(n, s, e)
print(e[0], e[1])


import math
n = int(input())

class point:
	x = 0
	y = 0

def kock(k, p1, p2):
	s = point()
	t = point()
	u = point()
	if k == 0:
		return
	s.x = (2 * p1.x + p2.x) / 3
	s.y = (2 * p1.y + p2.y) / 3
	t.x = (p1.x + 2 * p2.x) / 3
	t.y = (p1.y + 2 * p2.y) / 3
	u.x = (t.x - s.x) * math.cos(math.radians(60)) - (t.y - s.y) * math.sin(math.radians(60)) + s.x
	u.y = (t.x - s.x) * math.sin(math.radians(60)) + (t.y - s.y) * math.cos(math.radians(60)) + s.y
	kock(k - 1, p1, s)
	print(s.x, s.y)
	kock(k - 1, s, u)
	print(u.x, u.y)
	kock(k - 1, u, t)
	print(t.x, t.y)
	kock(k - 1, t, p2)
a = point()
b = point()
b.x = 100
print(a.x, a.y)
kock(n, a, b)
print(b.x, b.y)


def s(p, q):
	a = p[0]
	b = p[1]
	c = q[0]
	d = q[1]
	return [(2 * a + c) / 3, (2 * b + d) / 3]

def t(p, q):
	a = p[0]
	b = p[1]
	c = q[0]
	d = q[1]
	return [(a + 2 * c) / 3, (b + 2 * d) / 3]

def u(p, q):
	a = p[0]
	b = p[1]
	c = q[0]
	d = q[1]
	return [(a + c) / 2 + 3 ** (1 / 2) * (b - d) / 6, (b + d) / 2 + 3 ** (1 / 2) * (c - a) / 6]

def koch(p1, p2, n):
	if n == 0:
		return [p1]
	else:
		return koch(p1, s(p1, p2), n - 1) + koch(s(p1, p2), u(p1, p2), n - 1) + koch(u(p1, p2), t(p1, p2), n - 1) + koch(t(p1, p2), p2, n - 1)
n = int(input())
a = [0, 0]
b = [100, 0]
for i in koch(a, b, n):
	print(str(i[0]) + ' ' + str(i[1]))
print(str(b[0]) + ' ' + str(b[1]))


import math

class Point:

	def __init__(self, x, y):
		self.x = x
		self.y = y

	def __str__(self):
		return str(self.x) + ' ' + str(self.y)

def koch(n, a, b):
	if n == 0:
		return
	s = Point(0, 0)
	t = Point(0, 0)
	u = Point(0, 0)
	th = math.pi * 60 / 180
	s.x = (2 * a.x + 1 * b.x) / 3
	s.y = (2 * a.y + 1 * b.y) / 3
	t.x = (1 * a.x + 2 * b.x) / 3
	t.y = (1 * a.y + 2 * b.y) / 3
	u.x = (t.x - s.x) * math.cos(th) - (t.y - s.y) * math.sin(th) + s.x
	u.y = (t.x - s.x) * math.sin(th) + (t.y - s.y) * math.cos(th) + s.y
	koch(n - 1, a, s)
	print(s)
	koch(n - 1, s, u)
	print(u)
	koch(n - 1, u, t)
	print(t)
	koch(n - 1, t, b)
n = int(input())
a = Point(0, 0)
b = Point(100, 0)
print(a)
koch(n, a, b)
print(b)


import math

def koch(i, p, q):
	if i == n:
		print(' '.join(map(str, p)))
		if q[0] == 100:
			print(' '.join(map(str, q)))
		return
	x1 = (2 * p[0] + q[0]) / 3
	y1 = (2 * p[1] + q[1]) / 3
	x2 = (p[0] + 2 * q[0]) / 3
	y2 = (p[1] + 2 * q[1]) / 3
	x3 = math.cos(math.radians(60)) * (x2 - x1) - math.sin(math.radians(60)) * (y2 - y1) + x1
	y3 = math.sin(math.radians(60)) * (x2 - x1) + math.cos(math.radians(60)) * (y2 - y1) + y1
	koch(i + 1, p, [x1, y1])
	koch(i + 1, [x1, y1], [x3, y3])
	koch(i + 1, [x3, y3], [x2, y2])
	koch(i + 1, [x2, y2], q)
n = int(input())
koch(0, [0, 0], [100, 0])


import math
n = int(input())
(p1, p2) = ((0, 0), (100, 0))

def koch(d, p1, p2):
	if d == n:
		return
	th = math.radians(60)
	s = (2 / 3 * p1[0] + 1 / 3 * p2[0], 2 / 3 * p1[1] + 1 / 3 * p2[1])
	t = (1 / 3 * p1[0] + 2 / 3 * p2[0], 1 / 3 * p1[1] + 2 / 3 * p2[1])
	u = ((t[0] - s[0]) * math.cos(th) - (t[1] - s[1]) * math.sin(th) + s[0], (t[0] - s[0]) * math.sin(th) + (t[1] - s[1]) * math.cos(th) + s[1])
	koch(d + 1, p1, s)
	print(*s)
	koch(d + 1, s, u)
	print(*u)
	koch(d + 1, u, t)
	print(*t)
	koch(d + 1, t, p2)
print(*p1)
koch(0, p1, p2)
print(*p2)


import math

def plot(x, y):
	print(f'{x:.8f} {y:.8f}')

def koch(n, ax, ay, bx, by):
	if n == 0:
		plot(ax, ay)
		return
	sx = (2 * ax + bx) / 3
	sy = (2 * ay + by) / 3
	tx = (ax + 2 * bx) / 3
	ty = (ay + 2 * by) / 3
	ux = (tx - sx) * math.cos(math.radians(60)) - (ty - sy) * math.sin(math.radians(60)) + sx
	uy = (tx - sx) * math.sin(math.radians(60)) + (ty - sy) * math.cos(math.radians(60)) + sy
	koch(n - 1, ax, ay, sx, sy)
	koch(n - 1, sx, sy, ux, uy)
	koch(n - 1, ux, uy, tx, ty)
	koch(n - 1, tx, ty, bx, by)
n = int(input())
koch(n, 0, 0, 100, 0)
plot(100, 0)


import math

def plot(x, y):
	print(f'{x:.8f} {y:.8f}')

def Koch(n, x1, y1, x2, y2):
	if n == 0:
		plot(x1, y1)
		return
	sx = (2 * x1 + x2) / 3
	sy = (2 * y1 + y2) / 3
	tx = (x1 + 2 * x2) / 3
	ty = (y1 + 2 * y2) / 3
	ux = (tx - sx) / 2 - (ty - sy) * (math.sqrt(3) / 2) + sx
	uy = (tx - sx) * (math.sqrt(3) / 2) + (ty - sy) / 2 + sy
	Koch(n - 1, x1, y1, sx, sy)
	Koch(n - 1, sx, sy, ux, uy)
	Koch(n - 1, ux, uy, tx, ty)
	Koch(n - 1, tx, ty, x2, y2)
n = int(input())
Koch(n, 0, 0, 100, 0)
plot(100, 0)


p1 = [0, 0]
p2 = [100, 0]
R = [[0.5, -1.7320508 / 2], [1.7320508 / 2, 0.5]]

def dot(A, b):
	vs = [0, 0]
	for i in range(2):
		for j in range(2):
			vs[i] += A[i][j] * b[j]
	return vs

def diff(p1, p2):
	return [(p1[0] - p2[0]) / 3.0, (p1[1] - p2[1]) / 3.0]

def sumV(p1, p2):
	return [p1[0] + p2[0], p1[1] + p2[1]]

def new_koch(p1, p2):
	p = diff(p2, p1)
	p_new1 = sumV(p1, p)
	p_new2 = sumV(p_new1, dot(R, p))
	p_new3 = sumV(p1, sumV(p, p))
	return [p1, p_new1, p_new2, p_new3]
n = int(input())
ps = [p1, p2]
for i in range(n):
	X = len(ps)
	ps_new = []
	for i in range(X - 1):
		ps_new.extend(new_koch(ps[i], ps[i + 1]))
	ps_new += [ps[-1]]
	ps = [p for p in ps_new]
for p in ps:
	print(*p)


import math

def plot(x, y):
	print(f'{x:.8f} {y:.8f}')

def koch(n, x1, y1, x2, y2):
	if n == 0:
		plot(x1, y1)
		return
	sx = (2 * x1 + 1 * x2) / 3
	sy = (2 * y1 + 1 * y2) / 3
	tx = (1 * x1 + 2 * x2) / 3
	ty = (1 * y1 + 2 * y2) / 3
	ux = (tx - sx) * (1 / 2) - (ty - sy) * (math.sqrt(3) / 2) + sx
	uy = (tx - sx) * (math.sqrt(3) / 2) + (ty - sy) * (1 / 2) + sy
	koch(n - 1, x1, y1, sx, sy)
	koch(n - 1, sx, sy, ux, uy)
	koch(n - 1, ux, uy, tx, ty)
	koch(n - 1, tx, ty, x2, y2)
n = int(input())
koch(n, 0, 0, 100, 0)
plot(100, 0)


import math
n = int(input())

def koch(d, p1, p2):
	if d == 0:
		return
	s = [0, 0]
	t = [0, 0]
	u = [0, 0]
	s[0] = 2 / 3 * p1[0] + 1 / 3 * p2[0]
	s[1] = 2 / 3 * p1[1] + 1 / 3 * p2[1]
	t[0] = 1 / 3 * p1[0] + 2 / 3 * p2[0]
	t[1] = 1 / 3 * p1[1] + 2 / 3 * p2[1]
	u[0] = s[0] + (t[0] - s[0]) * math.cos(math.pi / 3) - (t[1] - s[1]) * math.sin(math.pi / 3)
	u[1] = s[1] + (t[0] - s[0]) * math.sin(math.pi / 3) + (t[1] - s[1]) * math.cos(math.pi / 3)
	koch(d - 1, p1, s)
	print(*s)
	koch(d - 1, s, u)
	print(*u)
	koch(d - 1, u, t)
	print(*t)
	koch(d - 1, t, p2)
print(0, 0)
koch(n, [0, 0], [100, 0])
print(100, 0)


import math

def plot(x, y):
	print(f'{x:.8f} {y:.8f}')

def Koch(n, x1, y1, x2, y2):
	if n == 0:
		plot(x1, y1)
		return
	sx = (2 * x1 + x2) / 3
	sy = (2 * y1 + y2) / 3
	tx = (x1 + 2 * x2) / 3
	ty = (y1 + 2 * y2) / 3
	ux = (tx - sx) * (1 / 2) - (ty - sy) * (math.sqrt(3) / 2) + sx
	uy = (tx - sx) * (math.sqrt(3) / 2) + (ty - sy) * (1 / 2) + sy
	Koch(n - 1, x1, y1, sx, sy)
	Koch(n - 1, sx, sy, ux, uy)
	Koch(n - 1, ux, uy, tx, ty)
	Koch(n - 1, tx, ty, x2, y2)
n = int(input())
Koch(n, 0, 0, 100, 0)
plot(100, 0)


import math
n = int(input())
koch = [(0.0, 0.0), (100.0, 0.0)]
SIN60 = math.sin(math.radians(60))
for i in range(n):
	nextKoch = []
	for j in range(len(koch) - 1):
		p1 = koch[j]
		p2 = koch[j + 1]
		s = ((p1[0] * 2 + p2[0]) / 3, (p1[1] * 2 + p2[1]) / 3)
		t = ((p1[0] + p2[0] * 2) / 3, (p1[1] + p2[1] * 2) / 3)
		ux = (t[0] - s[0]) / 2 - (t[1] - s[1]) * SIN60 + s[0]
		uy = (t[0] - s[0]) * SIN60 + (t[1] - s[1]) / 2 + s[1]
		u = (ux, uy)
		nextKoch[len(nextKoch):len(nextKoch)] = [p1, s, u, t]
	nextKoch.append(koch[-1])
	koch = nextKoch
for i in range(len(koch)):
	print('{0:.8f} {1:.8f}'.format(koch[i][0], koch[i][1]))


import math
n = int(input())
sin60 = math.sqrt(3) / 2
cos60 = 1 / 2

def koch(n, p1_x, p2_x, p1_y, p2_y):
	if n == 0:
		return
	s_x = (2 * p1_x + 1 * p2_x) / 3
	s_y = (2 * p1_y + 1 * p2_y) / 3
	t_x = (1 * p1_x + 2 * p2_x) / 3
	t_y = (1 * p1_y + 2 * p2_y) / 3
	u_x = (t_x - s_x) * cos60 - (t_y - s_y) * sin60 + s_x
	u_y = (t_x - s_x) * sin60 + (t_y - s_y) * cos60 + s_y
	koch(n - 1, p1_x, s_x, p1_y, s_y)
	print(s_x, s_y)
	koch(n - 1, s_x, u_x, s_y, u_y)
	print(u_x, u_y)
	koch(n - 1, u_x, t_x, u_y, t_y)
	print(t_x, t_y)
	koch(n - 1, t_x, p2_x, t_y, p2_y)
print(0.0, 0.0)
koch(n, 0, 100, 0, 0)
print(100.0, 0.0)