include Math

def koho(x1, y1, x2, y2, n)
    if n == 0 then
        return [[x1, y1], [x2, y2]]
    else 
        x_s = (x2 - x1) / 3.0 + x1
        y_s = (y2 - y1) / 3.0 + y1
        
        x_t = (x2 - x1) * 2 / 3.0 + x1
        y_t = (y2 - y1) * 2 / 3.0 + y1
        
        l = ((x_t - x_s) ** 2 + (y_t - y_s) ** 2 ) ** 0.5
        cosX = (x_t - x_s) / l
        sinX = (y_t - y_s) / l
        x_u = l * (0.5 * cosX - 3 ** 0.5 / 2 * sinX) + x_s
        y_u = l * (3 ** 0.5 / 2 * cosX + 0.5 * sinX) + y_s
        
        a1 = koho(x1, y1, x_s, y_s, n - 1)
        a2 = koho(x_s, y_s, x_u, y_u, n - 1)
        a3 = koho(x_u, y_u, x_t, y_t, n - 1)
        a4 = koho(x_t, y_t, x2, y2, n - 1)
        a1.pop
        a2.pop
        a3.pop
        return a1 + a2 + a3 + a4
    end
end

$s =[]

x1 = 0.0
y1 = 0.0
x2 = 100.0
y2 = 0.0
n = gets.to_i

ans = koho(x1, y1, x2, y2, n)

ans.each{|a|
    printf("%.8f %.8f\n", a[0],a[1])
}
