import math


def matrix_mul(mx1, mx2):
    n = len(mx1)
    m = len(mx1[0])
    _m = len(mx2)
    l = len(mx2[0])
    if m != _m:
        print("[!] Invalid Matrix Size.")
        return - 1

    ans = [[None] * l for _ in range(n)]

    for i in range(n):
        for j in range(l):
            _e = 0
            for k in range(m):
                _e += mx1[i][k] * mx2[k][j]
            ans[i][j] = _e

    return ans


def roll(p1, p2, r: int):
    """r must be radian"""
    _tmp = [[p2[0] - p1[0]], [p2[1] - p1[1]]]
    rad = math.pi*r/180
    matrix = [[math.cos(rad), -math.sin(rad)], [math.sin(rad), math.cos(rad)]]
    _tmp = matrix_mul(matrix, _tmp)
    return [p1[0]+_tmp[0][0], p1[1]+_tmp[1][0]]


def print_point(p):
    print("%.8f %.8f" % (p[0], p[1]))


def koch_curve(p1, p2, d: int):
    """p1: start point, p2: end point, d: depth of recursive"""
    if d == 0:
        print_point(p2)
    else:
        s = [p1[0] + (p2[0] - p1[0])/3, p1[1] + (p2[1] - p1[1])/3]
        t = [p1[0] + (p2[0] - p1[0])*2/3, p1[1] + (p2[1] - p1[1])*2/3]
        u = roll(s, t, 60)
        koch_curve(p1, s, d - 1)
        koch_curve(s, u, d - 1)
        koch_curve(u, t, d - 1)
        koch_curve(t, p2, d - 1)


n = int(input())
p1, p2 = [0.0, 0.0], [100.0, 0.0]
print_point(p1)
koch_curve(p1, p2, n)
 import math math def matrix_mul(mx1, mx2):
    n = len(mx1)
    m = len(mx1[0])
    _m = len(mx2)
    l = len(mx2[0])
    if m != _m:
        print("[!] Invalid Matrix Size.")
        return - 1

    ans = [[None] * l for _ in range(n)]

    for i in range(n):
        for j in range(l):
            _e = 0
            for k in range(m):
                _e += mx1[i][k] * mx2[k][j]
            ans[i][j] = _e

    return ans matrix_mul n = len(mx1) n len(mx1) len mx1 m = len(mx1[0]) m len(mx1[0]) len mx1[0] mx1 0 _m = len(mx2) _m len(mx2) len mx2 l = len(mx2[0]) l len(mx2[0]) len mx2[0] mx2 0 if m != _m:
        print("[!] Invalid Matrix Size.")
        return - 1

     m != _m m _m print("[!] Invalid Matrix Size.") print "[!] Invalid Matrix Size." return - 1 - 1 [None] * l for _ in range(n) for _ in range(n) _ range(n) range n for _ in range(n) [None] * l [None] None l ans = [[None] * l for _ in range(n)] ans [[None] * l for _ in range(n)] for i in range(n):
        for j in range(l):
            _e = 0
            for k in range(m):
                _e += mx1[i][k] * mx2[k][j]
            ans[i][j] = _e

     i range(n) range n for j in range(l):
            _e = 0
            for k in range(m):
                _e += mx1[i][k] * mx2[k][j]
            ans[i][j] = _e

     j range(l) range l _e = 0 _e 0 for k in range(m):
                _e += mx1[i][k] * mx2[k][j]
             k range(m) range m _e += mx1[i][k] * mx2[k][j] _e mx1[i][k] * mx2[k][j] mx1[i][k] [i] mx1 i k mx2[k][j] [k] mx2 k j ans[i][j] = _e ans[i][j] [i] ans i j _e return ans ans mx1 mx1 mx2 mx2 def roll(p1, p2, r: int):
    """r must be radian"""
    _tmp = [[p2[0] - p1[0]], [p2[1] - p1[1]]]
    rad = math.pi*r/180
    matrix = [[math.cos(rad), -math.sin(rad)], [math.sin(rad), math.cos(rad)]]
    _tmp = matrix_mul(matrix, _tmp)
    return [p1[0]+_tmp[0][0], p1[1]+_tmp[1][0]] roll """r must be radian""" _tmp = [[p2[0] - p1[0]], [p2[1] - p1[1]]] _tmp [[p2[0] - p1[0]], [p2[1] - p1[1]]] [p2[0] - p1[0]] p2[0] - p1[0] p2[0] p2 0 p1[0] p1 0 [p2[1] - p1[1]] p2[1] - p1[1] p2[1] p2 1 p1[1] p1 1 rad = math.pi*r/180 rad math.pi*r/180 math.pi*r math.pi math pi r 180 matrix = [[math.cos(rad), -math.sin(rad)], [math.sin(rad), math.cos(rad)]] matrix [[math.cos(rad), -math.sin(rad)], [math.sin(rad), math.cos(rad)]] [math.cos(rad), -math.sin(rad)] math.cos(rad) math.cos math cos rad -math.sin(rad) math.sin(rad) math.sin math sin rad [math.sin(rad), math.cos(rad)] math.sin(rad) math.sin math sin rad math.cos(rad) math.cos math cos rad _tmp = matrix_mul(matrix, _tmp) _tmp matrix_mul(matrix, _tmp) matrix_mul matrix _tmp return [p1[0]+_tmp[0][0], p1[1]+_tmp[1][0]] [p1[0]+_tmp[0][0], p1[1]+_tmp[1][0]] p1[0]+_tmp[0][0] p1[0] p1 0 _tmp[0][0] [0] _tmp 0 0 p1[1]+_tmp[1][0] p1[1] p1 1 _tmp[1][0] [1] _tmp 1 0 p1 p1 p2 p2 r: int r def print_point(p):
    print("%.8f %.8f" % (p[0], p[1])) print_point print("%.8f %.8f" % (p[0], p[1])) print "%.8f %.8f" % (p[0], p[1]) "%.8f %.8f" (p[0], p[1]) p[0] p 0 p[1] p 1 p p def koch_curve(p1, p2, d: int):
    """p1: start point, p2: end point, d: depth of recursive"""
    if d == 0:
        print_point(p2)
    else:
        s = [p1[0] + (p2[0] - p1[0])/3, p1[1] + (p2[1] - p1[1])/3]
        t = [p1[0] + (p2[0] - p1[0])*2/3, p1[1] + (p2[1] - p1[1])*2/3]
        u = roll(s, t, 60)
        koch_curve(p1, s, d - 1)
        koch_curve(s, u, d - 1)
        koch_curve(u, t, d - 1)
        koch_curve(t, p2, d - 1) koch_curve """p1: start point, p2: end point, d: depth of recursive""" if d == 0:
        print_point(p2)
    else:
        s = [p1[0] + (p2[0] - p1[0])/3, p1[1] + (p2[1] - p1[1])/3]
        t = [p1[0] + (p2[0] - p1[0])*2/3, p1[1] + (p2[1] - p1[1])*2/3]
        u = roll(s, t, 60)
        koch_curve(p1, s, d - 1)
        koch_curve(s, u, d - 1)
        koch_curve(u, t, d - 1)
        koch_curve(t, p2, d - 1) d == 0 d 0 print_point(p2) print_point p2 s = [p1[0] + (p2[0] - p1[0])/3, p1[1] + (p2[1] - p1[1])/3] s [p1[0] + (p2[0] - p1[0])/3, p1[1] + (p2[1] - p1[1])/3] p1[0] + (p2[0] - p1[0])/3 p1[0] p1 0 (p2[0] - p1[0])/3 p2[0] - p1[0] p2[0] p2 0 p1[0] p1 0 3 p1[1] + (p2[1] - p1[1])/3 p1[1] p1 1 (p2[1] - p1[1])/3 p2[1] - p1[1] p2[1] p2 1 p1[1] p1 1 3 t = [p1[0] + (p2[0] - p1[0])*2/3, p1[1] + (p2[1] - p1[1])*2/3] t [p1[0] + (p2[0] - p1[0])*2/3, p1[1] + (p2[1] - p1[1])*2/3] p1[0] + (p2[0] - p1[0])*2/3 p1[0] p1 0 (p2[0] - p1[0])*2/3 (p2[0] - p1[0])*2 p2[0] - p1[0] p2[0] p2 0 p1[0] p1 0 2 3 p1[1] + (p2[1] - p1[1])*2/3 p1[1] p1 1 (p2[1] - p1[1])*2/3 (p2[1] - p1[1])*2 p2[1] - p1[1] p2[1] p2 1 p1[1] p1 1 2 3 u = roll(s, t, 60) u roll(s, t, 60) roll s t 60 koch_curve(p1, s, d - 1) koch_curve p1 s d - 1 d 1 koch_curve(s, u, d - 1) koch_curve s u d - 1 d 1 koch_curve(u, t, d - 1) koch_curve u t d - 1 d 1 koch_curve(t, p2, d - 1) koch_curve t p2 d - 1 d 1 p1 p1 p2 p2 d: int d n = int(input()) n int(input()) int input() input p1, p2 = [0.0, 0.0], [100.0, 0.0] p1 [0.0, 0.0] 0.0 0.0 p2 [100.0, 0.0] 100.0 0.0 print_point(p1) print_point p1 koch_curve(p1, p2, n) koch_curve p1 p2 n n = int(input()) int(input()) n def koch_curve(p1, p2, d: int):
    """p1: start point, p2: end point, d: depth of recursive"""
    if d == 0:
        print_point(p2)
    else:
        s = [p1[0] + (p2[0] - p1[0])/3, p1[1] + (p2[1] - p1[1])/3]
        t = [p1[0] + (p2[0] - p1[0])*2/3, p1[1] + (p2[1] - p1[1])*2/3]
        u = roll(s, t, 60)
        koch_curve(p1, s, d - 1)
        koch_curve(s, u, d - 1)
        koch_curve(u, t, d - 1)
        koch_curve(t, p2, d - 1) def koch_curve(p1, p2, d: int):
    """p1: start point, p2: end point, d: depth of recursive"""
    if d == 0:
        print_point(p2)
    else:
        s = [p1[0] + (p2[0] - p1[0])/3, p1[1] + (p2[1] - p1[1])/3]
        t = [p1[0] + (p2[0] - p1[0])*2/3, p1[1] + (p2[1] - p1[1])*2/3]
        u = roll(s, t, 60)
        koch_curve(p1, s, d - 1)
        koch_curve(s, u, d - 1)
        koch_curve(u, t, d - 1)
        koch_curve(t, p2, d - 1) koch_curve def matrix_mul(mx1, mx2):
    n = len(mx1)
    m = len(mx1[0])
    _m = len(mx2)
    l = len(mx2[0])
    if m != _m:
        print("[!] Invalid Matrix Size.")
        return - 1

    ans = [[None] * l for _ in range(n)]

    for i in range(n):
        for j in range(l):
            _e = 0
            for k in range(m):
                _e += mx1[i][k] * mx2[k][j]
            ans[i][j] = _e

    return ans def matrix_mul(mx1, mx2):
    n = len(mx1)
    m = len(mx1[0])
    _m = len(mx2)
    l = len(mx2[0])
    if m != _m:
        print("[!] Invalid Matrix Size.")
        return - 1

    ans = [[None] * l for _ in range(n)]

    for i in range(n):
        for j in range(l):
            _e = 0
            for k in range(m):
                _e += mx1[i][k] * mx2[k][j]
            ans[i][j] = _e

    return ans matrix_mul p1, p2 = [0.0, 0.0], [100.0, 0.0] [0.0, 0.0] p1 def print_point(p):
    print("%.8f %.8f" % (p[0], p[1])) def print_point(p):
    print("%.8f %.8f" % (p[0], p[1])) print_point def roll(p1, p2, r: int):
    """r must be radian"""
    _tmp = [[p2[0] - p1[0]], [p2[1] - p1[1]]]
    rad = math.pi*r/180
    matrix = [[math.cos(rad), -math.sin(rad)], [math.sin(rad), math.cos(rad)]]
    _tmp = matrix_mul(matrix, _tmp)
    return [p1[0]+_tmp[0][0], p1[1]+_tmp[1][0]] def roll(p1, p2, r: int):
    """r must be radian"""
    _tmp = [[p2[0] - p1[0]], [p2[1] - p1[1]]]
    rad = math.pi*r/180
    matrix = [[math.cos(rad), -math.sin(rad)], [math.sin(rad), math.cos(rad)]]
    _tmp = matrix_mul(matrix, _tmp)
    return [p1[0]+_tmp[0][0], p1[1]+_tmp[1][0]] roll p2 = [0.0, 0.0], [100.0, 0.0] [100.0, 0.0] p2
import math


def matrix_mul(mx1, mx2):
    n = len(mx1)
    m = len(mx1[0])
    _m = len(mx2)
    l = len(mx2[0])
    if m != _m:
        print("[!] Invalid Matrix Size.")
        return - 1

    ans = [[None] * l for _ in range(n)]

    for i in range(n):
        for j in range(l):
            _e = 0
            for k in range(m):
                _e += mx1[i][k] * mx2[k][j]
            ans[i][j] = _e

    return ans


def roll(p1, p2, r: int):
    """r must be radian"""
    _tmp = [[p2[0] - p1[0]], [p2[1] - p1[1]]]
    rad = math.pi*r/180
    matrix = [[math.cos(rad), -math.sin(rad)], [math.sin(rad), math.cos(rad)]]
    _tmp = matrix_mul(matrix, _tmp)
    return [p1[0]+_tmp[0][0], p1[1]+_tmp[1][0]]


def print_point(p):
    print("%.8f %.8f" % (p[0], p[1]))


def koch_curve(p1, p2, d: int):
    """p1: start point, p2: end point, d: depth of recursive"""
    if d == 0:
        print_point(p2)
    else:
        s = [p1[0] + (p2[0] - p1[0])/3, p1[1] + (p2[1] - p1[1])/3]
        t = [p1[0] + (p2[0] - p1[0])*2/3, p1[1] + (p2[1] - p1[1])*2/3]
        u = roll(s, t, 60)
        koch_curve(p1, s, d - 1)
        koch_curve(s, u, d - 1)
        koch_curve(u, t, d - 1)
        koch_curve(t, p2, d - 1)


n = int(input())
p1, p2 = [0.0, 0.0], [100.0, 0.0]
print_point(p1)
koch_curve(p1, p2, n)

