import Control.Monad (mapM_)
import Text.Printf (printf)

type Point = (Double, Double)

infixl 4 |+|
(|+|) :: Point -> Point -> Point
(|+|) (x,y) (z,w) = (x+z,y+w)

infixl 4 |-|
(|-|) :: Point -> Point -> Point
(|-|) (x,y) (z,w) = (x-z,y-w)

infixl 5 |*|
(|*|) :: Point -> Double -> Point
(|*|) (x,y) k = (k*x, k*y)

infixl 5 |/|
(|/|) :: Point -> Double -> Point
(|/|) (x,y) d = (x/d, y/d)

norm :: Point -> Double
norm (x,y) = sqrt $ x*x+y*y

printPt :: Point -> IO ()
printPt (x,y) = printf "%.8f %.8f\n" x y

koch :: Int -> Point -> Point -> [Point]
koch 0 _ _ = []
koch n p1 p2 = koch (n-1) p1 s ++ [s] ++ koch (n-1) s u ++ [u] ++ koch (n-1) u t ++ [t] ++ koch (n-1) t p2
  where
    s = (p1|*|2 |+| p2|*|1)|/|3
    t = (p1|*|1 |+| p2|*|2)|/|3
    u = ((fst p1+fst p2)/2, norm (p2|-|p1)/3*sqrt 3/2)

main :: IO ()
main = do
  n <- readLn
  mapM_ printPt $ (0,0):koch n (0,0) (100,0) ++ [(100,0)]