{-# OPTIONS_GHC -Wall #-}

readInt :: String -> Int
readInt = read

data Vec = Vec Double Double

instance Show Vec where
    show (Vec x y) = show x ++ " " ++ show y

add :: Vec -> Vec -> Vec
add (Vec x1 y1) (Vec x2 y2) = Vec (x1+x2) (y1+y2)

sub :: Vec -> Vec -> Vec
sub (Vec x1 y1) (Vec x2 y2) = Vec (x1-x2) (y1-y2)

mul :: Vec -> Double -> Vec
mul (Vec x y) c = Vec (c*x) (c*y)

rot :: Vec -> Double -> Vec
rot (Vec x y) t = Vec (x*cos t-y*sin t) (x*sin t+y*cos t)

koch :: Int -> Vec -> Vec -> [Vec]
koch 0 _ _ = []
koch n p1 p5 =
    koch (n-1) p1 p2 ++
    [p2] ++
    koch (n-1) p2 p3 ++
    [p3] ++
    koch (n-1) p3 p4 ++
    [p4] ++
    koch (n-1) p4 p5
        where
            v = mul (sub p5 p1) (1/3)
            p2 = add p1 v
            p3 = add p2 $ rot v (pi/3)
            p4 = add p2 v

main :: IO ()
main = do
    n <- fmap readInt getLine

    let p1 = Vec 0.0 0.0
    let p5 = Vec 100.0 0.0
    let ans = [p1] ++ koch n p1 p5 ++ [p5]

    mapM_ print ans

