# AOJでnumpyが使えないから自力で内積を求める
import sys
# import numpy as np
import math

input = sys.stdin.readline
n = int(input())
# ベクトルの60度回転で使う
cos60 = math.cos(math.radians(60))
sin60 = math.sin(math.radians(60))
# k = np.array([[cos60, -(sin60)], [sin60, cos60]])
k = ([[cos60, -(sin60)], [sin60, cos60]])


def main():
    start = [0.00000000, 0.00000000]
    end = [100.00000000, 0.00000000]
    print(' '.join(map(str, start)))
    Koch(start, end, 0)
    print(' '.join(map(str, end)))


def Koch(start, end, layer):
    layer += 1
    if layer > n:
        return
    point1 = [((end[0] - start[0]) / 3) + start[0], ((end[1] - start[1]) / 3) + start[1]]
    Koch(start, point1, layer)
    print(' '.join(map(str, point1)))
    point3 = [((end[0] - start[0]) / 3 * 2) + start[0], ((end[1] - start[1]) / 3 * 2) + start[1]]
    # vec = np.array([[point3[0] - point1[0]], [point3[1] - point1[1]]])  # vecは一旦原点に戻す
    vec = ([[point3[0] - point1[0]], [point3[1] - point1[1]]])  # vecは一旦原点に戻す
    point2 = [[k[0][0] * vec[0][0] + k[0][1] * vec[1][0]], [k[1][0] * vec[0][0] + k[1][1] * vec[1][0]]]  # 内積をとって60度左回転する
    point2 = [point2[0][0] + point1[0], point2[1][0] + point1[1]]  # 元あった点に戻す
    Koch(point1, point2, layer)
    print(' '.join(map(str, point2)))
    Koch(point2, point3, layer)
    print(' '.join(map(str, point3)))
    Koch(point3, end, layer)


if __name__ == '__main__':
    main()
 import sys sys import math math input = sys.stdin.readline input sys.stdin.readline sys.stdin sys stdin readline n = int(input()) n int(input()) int input() input cos60 = math.cos(math.radians(60)) cos60 math.cos(math.radians(60)) math.cos math cos math.radians(60) math.radians math radians 60 sin60 = math.sin(math.radians(60)) sin60 math.sin(math.radians(60)) math.sin math sin math.radians(60) math.radians math radians 60 k = ([[cos60, -(sin60)], [sin60, cos60]]) k [[cos60, -(sin60)], [sin60, cos60]] [cos60, -(sin60)] cos60 -(sin60) sin60 [sin60, cos60] sin60 cos60 def main():
    start = [0.00000000, 0.00000000]
    end = [100.00000000, 0.00000000]
    print(' '.join(map(str, start)))
    Koch(start, end, 0)
    print(' '.join(map(str, end))) main start = [0.00000000, 0.00000000] start [0.00000000, 0.00000000] 0.00000000 0.00000000 end = [100.00000000, 0.00000000] end [100.00000000, 0.00000000] 100.00000000 0.00000000 print(' '.join(map(str, start))) print ' '.join(map(str, start)) ' '.join ' ' join map(str, start) map str start Koch(start, end, 0) Koch start end 0 print(' '.join(map(str, end))) print ' '.join(map(str, end)) ' '.join ' ' join map(str, end) map str end def Koch(start, end, layer):
    layer += 1
    if layer > n:
        return
    point1 = [((end[0] - start[0]) / 3) + start[0], ((end[1] - start[1]) / 3) + start[1]]
    Koch(start, point1, layer)
    print(' '.join(map(str, point1)))
    point3 = [((end[0] - start[0]) / 3 * 2) + start[0], ((end[1] - start[1]) / 3 * 2) + start[1]]
    # vec = np.array([[point3[0] - point1[0]], [point3[1] - point1[1]]])  # vecは一旦原点に戻す
    vec = ([[point3[0] - point1[0]], [point3[1] - point1[1]]])  # vecは一旦原点に戻す
    point2 = [[k[0][0] * vec[0][0] + k[0][1] * vec[1][0]], [k[1][0] * vec[0][0] + k[1][1] * vec[1][0]]]  # 内積をとって60度左回転する
    point2 = [point2[0][0] + point1[0], point2[1][0] + point1[1]]  # 元あった点に戻す
    Koch(point1, point2, layer)
    print(' '.join(map(str, point2)))
    Koch(point2, point3, layer)
    print(' '.join(map(str, point3)))
    Koch(point3, end, layer) Koch layer += 1 layer 1 if layer > n:
        return
     layer > n layer n return point1 = [((end[0] - start[0]) / 3) + start[0], ((end[1] - start[1]) / 3) + start[1]] point1 [((end[0] - start[0]) / 3) + start[0], ((end[1] - start[1]) / 3) + start[1]] ((end[0] - start[0]) / 3) + start[0] (end[0] - start[0]) / 3 end[0] - start[0] end[0] end 0 start[0] start 0 3 start[0] start 0 ((end[1] - start[1]) / 3) + start[1] (end[1] - start[1]) / 3 end[1] - start[1] end[1] end 1 start[1] start 1 3 start[1] start 1 Koch(start, point1, layer) Koch start point1 layer print(' '.join(map(str, point1))) print ' '.join(map(str, point1)) ' '.join ' ' join map(str, point1) map str point1 point3 = [((end[0] - start[0]) / 3 * 2) + start[0], ((end[1] - start[1]) / 3 * 2) + start[1]] point3 [((end[0] - start[0]) / 3 * 2) + start[0], ((end[1] - start[1]) / 3 * 2) + start[1]] ((end[0] - start[0]) / 3 * 2) + start[0] (end[0] - start[0]) / 3 * 2 (end[0] - start[0]) / 3 end[0] - start[0] end[0] end 0 start[0] start 0 3 2 start[0] start 0 ((end[1] - start[1]) / 3 * 2) + start[1] (end[1] - start[1]) / 3 * 2 (end[1] - start[1]) / 3 end[1] - start[1] end[1] end 1 start[1] start 1 3 2 start[1] start 1 vec = ([[point3[0] - point1[0]], [point3[1] - point1[1]]]) vec [[point3[0] - point1[0]], [point3[1] - point1[1]]] [point3[0] - point1[0]] point3[0] - point1[0] point3[0] point3 0 point1[0] point1 0 [point3[1] - point1[1]] point3[1] - point1[1] point3[1] point3 1 point1[1] point1 1 point2 = [[k[0][0] * vec[0][0] + k[0][1] * vec[1][0]], [k[1][0] * vec[0][0] + k[1][1] * vec[1][0]]] point2 [[k[0][0] * vec[0][0] + k[0][1] * vec[1][0]], [k[1][0] * vec[0][0] + k[1][1] * vec[1][0]]] [k[0][0] * vec[0][0] + k[0][1] * vec[1][0]] k[0][0] * vec[0][0] + k[0][1] * vec[1][0] k[0][0] * vec[0][0] k[0][0] [0] k 0 0 vec[0][0] [0] vec 0 0 k[0][1] * vec[1][0] k[0][1] [0] k 0 1 vec[1][0] [1] vec 1 0 [k[1][0] * vec[0][0] + k[1][1] * vec[1][0]] k[1][0] * vec[0][0] + k[1][1] * vec[1][0] k[1][0] * vec[0][0] k[1][0] [1] k 1 0 vec[0][0] [0] vec 0 0 k[1][1] * vec[1][0] k[1][1] [1] k 1 1 vec[1][0] [1] vec 1 0 point2 = [point2[0][0] + point1[0], point2[1][0] + point1[1]] point2 [point2[0][0] + point1[0], point2[1][0] + point1[1]] point2[0][0] + point1[0] point2[0][0] [0] point2 0 0 point1[0] point1 0 point2[1][0] + point1[1] point2[1][0] [1] point2 1 0 point1[1] point1 1 Koch(point1, point2, layer) Koch point1 point2 layer print(' '.join(map(str, point2))) print ' '.join(map(str, point2)) ' '.join ' ' join map(str, point2) map str point2 Koch(point2, point3, layer) Koch point2 point3 layer print(' '.join(map(str, point3))) print ' '.join(map(str, point3)) ' '.join ' ' join map(str, point3) map str point3 Koch(point3, end, layer) Koch point3 end layer start start end end layer layer if __name__ == '__main__':
    main() __name__ == '__main__' __name__ '__main__' main() main def main():
    start = [0.00000000, 0.00000000]
    end = [100.00000000, 0.00000000]
    print(' '.join(map(str, start)))
    Koch(start, end, 0)
    print(' '.join(map(str, end))) def main():
    start = [0.00000000, 0.00000000]
    end = [100.00000000, 0.00000000]
    print(' '.join(map(str, start)))
    Koch(start, end, 0)
    print(' '.join(map(str, end))) main k = ([[cos60, -(sin60)], [sin60, cos60]]) [[cos60, -(sin60)], [sin60, cos60]] k sin60 = math.sin(math.radians(60)) math.sin(math.radians(60)) sin60 input = sys.stdin.readline sys.stdin.readline input def Koch(start, end, layer):
    layer += 1
    if layer > n:
        return
    point1 = [((end[0] - start[0]) / 3) + start[0], ((end[1] - start[1]) / 3) + start[1]]
    Koch(start, point1, layer)
    print(' '.join(map(str, point1)))
    point3 = [((end[0] - start[0]) / 3 * 2) + start[0], ((end[1] - start[1]) / 3 * 2) + start[1]]
    # vec = np.array([[point3[0] - point1[0]], [point3[1] - point1[1]]])  # vecは一旦原点に戻す
    vec = ([[point3[0] - point1[0]], [point3[1] - point1[1]]])  # vecは一旦原点に戻す
    point2 = [[k[0][0] * vec[0][0] + k[0][1] * vec[1][0]], [k[1][0] * vec[0][0] + k[1][1] * vec[1][0]]]  # 内積をとって60度左回転する
    point2 = [point2[0][0] + point1[0], point2[1][0] + point1[1]]  # 元あった点に戻す
    Koch(point1, point2, layer)
    print(' '.join(map(str, point2)))
    Koch(point2, point3, layer)
    print(' '.join(map(str, point3)))
    Koch(point3, end, layer) def Koch(start, end, layer):
    layer += 1
    if layer > n:
        return
    point1 = [((end[0] - start[0]) / 3) + start[0], ((end[1] - start[1]) / 3) + start[1]]
    Koch(start, point1, layer)
    print(' '.join(map(str, point1)))
    point3 = [((end[0] - start[0]) / 3 * 2) + start[0], ((end[1] - start[1]) / 3 * 2) + start[1]]
    # vec = np.array([[point3[0] - point1[0]], [point3[1] - point1[1]]])  # vecは一旦原点に戻す
    vec = ([[point3[0] - point1[0]], [point3[1] - point1[1]]])  # vecは一旦原点に戻す
    point2 = [[k[0][0] * vec[0][0] + k[0][1] * vec[1][0]], [k[1][0] * vec[0][0] + k[1][1] * vec[1][0]]]  # 内積をとって60度左回転する
    point2 = [point2[0][0] + point1[0], point2[1][0] + point1[1]]  # 元あった点に戻す
    Koch(point1, point2, layer)
    print(' '.join(map(str, point2)))
    Koch(point2, point3, layer)
    print(' '.join(map(str, point3)))
    Koch(point3, end, layer) Koch cos60 = math.cos(math.radians(60)) math.cos(math.radians(60)) cos60 n = int(input()) int(input()) n
# AOJでnumpyが使えないから自力で内積を求める
import sys
# import numpy as np
import math

input = sys.stdin.readline
n = int(input())
# ベクトルの60度回転で使う
cos60 = math.cos(math.radians(60))
sin60 = math.sin(math.radians(60))
# k = np.array([[cos60, -(sin60)], [sin60, cos60]])
k = ([[cos60, -(sin60)], [sin60, cos60]])


def main():
    start = [0.00000000, 0.00000000]
    end = [100.00000000, 0.00000000]
    print(' '.join(map(str, start)))
    Koch(start, end, 0)
    print(' '.join(map(str, end)))


def Koch(start, end, layer):
    layer += 1
    if layer > n:
        return
    point1 = [((end[0] - start[0]) / 3) + start[0], ((end[1] - start[1]) / 3) + start[1]]
    Koch(start, point1, layer)
    print(' '.join(map(str, point1)))
    point3 = [((end[0] - start[0]) / 3 * 2) + start[0], ((end[1] - start[1]) / 3 * 2) + start[1]]
    # vec = np.array([[point3[0] - point1[0]], [point3[1] - point1[1]]])  # vecは一旦原点に戻す
    vec = ([[point3[0] - point1[0]], [point3[1] - point1[1]]])  # vecは一旦原点に戻す
    point2 = [[k[0][0] * vec[0][0] + k[0][1] * vec[1][0]], [k[1][0] * vec[0][0] + k[1][1] * vec[1][0]]]  # 内積をとって60度左回転する
    point2 = [point2[0][0] + point1[0], point2[1][0] + point1[1]]  # 元あった点に戻す
    Koch(point1, point2, layer)
    print(' '.join(map(str, point2)))
    Koch(point2, point3, layer)
    print(' '.join(map(str, point3)))
    Koch(point3, end, layer)


if __name__ == '__main__':
    main()

