--Koch-recursion
type Coord= (Double,Double)

koch_n_vertex::Int -> [Coord]
koch_n_vertex 0 = [(1.0,0.0)]
koch_n_vertex n = let rec = koch_n_vertex (n-1) in
                  let pt1 = map trans1 rec in
                  let pt2 = map trans2 rec in
                  let pt3 = map trans3 rec in
                  let pt4 = map trans4 rec in
                  pt1++pt2++pt3++pt4

trans1::Coord -> Coord
trans1 (x,y) = ((1/3)*x,(1/3)*y)

trans2::Coord -> Coord
trans2 coord = let (x',y')= rotate (pi/3) (trans1 coord) in (x'+(1/3),y')

trans3::Coord -> Coord
trans3 coord = let (x',y')= rotate ((-pi)/3) (trans1 coord) in (x'+(1/2),y'+((sin (pi/3))/3))

trans4::Coord -> Coord
trans4 coord = let (x',y')= trans1 coord in (x'+(2/3),y')

rotate::Double->Coord -> Coord
rotate rad (x,y) = let s = sin rad in let c = cos rad in ((x*c)-(y*s),(x*s)+(y*c))

solver::Int -> [Coord]
solver n = map (\(x,y)-> (100.0*x,100.0*y)) ((0.0,0.0):koch_n_vertex n)

printer::Show a => [(a,a)]-> IO ()
printer [] = return ()
printer ((x,y):xs) = do
  putStr ((show x)++" "++(show y)++"\n")
  printer xs

main::IO()
main = do
  nc<-getLine
  let n= read nc ::Int
  printer (solver n)