module Main where
import Debug.Trace
import Data.List
import qualified Data.Sequence as S
import qualified Data.ByteString.Char8 as B
import Data.Int
import Data.Char
import Data.Array
import Data.Maybe
import qualified Data.Map as M
import Data.Ord
import Data.Functor
import Control.Applicative
import Control.Monad

rt3 = sqrt 3

data Point = Point Double Double deriving (Eq)
instance Show Point where
    show (Point x y) = show x ++ " " ++ show y

solve :: Int -> [Point]
solve = iter [(Point 0 0),(Point 100 0)] where
    iter pl 0 = pl
    iter pl n = iter (iter1 pl) (n-1)
    iter1 [p] = [p]
    iter1 (p@(Point px py):q@(Point qx qy):ps) = p:s:u:t:iter1 (q:ps) where
        s = Point (px*2/3 + qx/3) (py*2/3 + qy/3)
        t = Point (px/3 + qx*2/3) (py/3 + qy*2/3)
        u = Point (px/2 + qx/2 - rt3/6*qy + rt3/6*py) (rt3/6*qx - rt3/6*px + qy/2 + py/2) 

readIntLn:: IO Int
readIntLn = (fst . fromJust . B.readInt) <$> B.getLine

main :: IO() 
main = do
    n <- readIntLn
    let l = solve n
    mapM_ print l

