{-# LANGUAGE BangPatterns #-}

import           Control.Applicative
import           Control.Monad
import           Debug.Trace

type Point = (Double, Double)

rotate60 :: Point -> Point
rotate60 (x, y) = (x', y')
  where
    x' = x * cos rad - y * sin rad
    y' = x * sin rad + y * cos rad
    rad = pi / 180 * 60

koch2 :: Point -> Point -> [Point]
koch2 (x1, y1) (x2, y2) =
    [ (x3, y3)
    , (x4, y4)
    , (x5, y5)
    ]
  where
    xu = (x2 - x1) / 3
    yu = (y2 - y1) / 3
    x3 = x1 + xu
    x5 = x1 + xu * 2
    y3 = y1 + yu
    y5 = y1 + yu * 2
    (x4, y4) =
        let (sx, sy) = rotate60 (x5 - x3, y5 - y3)
         in (sx + x3, sy + y3)

koch1 :: [Point] -> [Point]
koch1 []         = []
koch1 [p]        = [p]
koch1 (p1:p2:ps) = p1 : koch2 p1 p2 ++ koch1 (p2:ps)

koch :: Int -> [Point] -> [Point]
koch n ps = go 0 ps
  where
    go !k !qs
        | k == n    = qs
        | otherwise = go (k + 1) (koch1 qs)

printPoint :: Point -> IO ()
printPoint (x, y) = putStrLn $ show x ++ " " ++ show y

main :: IO ()
main = do
    n <- readLn
    let ps = koch n [(0, 0), (100, 0)]
    mapM_ printPoint ps

