use std::io::*;
use std::str::FromStr;
#[allow(unused_imports)]
use std::collections::*;
#[allow(unused_imports)]
use std::cmp::{min, max};

struct Scanner<R: Read> {
    reader: R,
    buffer: String,
}

#[allow(dead_code)]
impl<R: Read> Scanner<R> {
    fn new(reader: R) -> Scanner<R> {
        Scanner { reader: reader, buffer: String::new() }
    }

    // fn line(&mut self) -> String {
    //     self.buffer = self.reader.by_ref().bytes().map(|c| c.unwrap() as char)
    //         .skip_while(|&c| c == '\n' || c == '\r')
    //         .take_while(|&c| !(c == '\n' || c == '\r'))
    //         .collect::<String>();
    //     self.buffer.clone()
    // }

    fn read_buffer(&mut self) {
        self.buffer = self.reader.by_ref().bytes().map(|c| c.unwrap() as char)
            .skip_while(|c| c.is_whitespace())
            .take_while(|c| !c.is_whitespace())
            .collect::<String>();
    }

    fn safe_read<T: FromStr>(&mut self) -> Option<T> {
        self.read_buffer();
        if self.buffer.is_empty() {
            None
        } else {
            self.buffer.parse::<T>().ok()
        }
    }

    fn read<T: FromStr>(&mut self) -> T {
        if let Some(s) = self.safe_read() {
            s
        } else {
            // writeln!(std::io::stderr(), "Terminated with EOF").unwrap();
            std::process::exit(0);
        }
    }

    fn vec<T: FromStr>(&mut self, len: usize) -> Vec<T> {
        (0..len).map(|_| self.read()).collect()
    }

    fn mat<T: FromStr>(&mut self, row: usize, col: usize) -> Vec<Vec<T>> {
        (0..row).map(|_| self.vec(col)).collect()
    }
}

trait Joinable {
    fn join(self, sep: &str) -> String;
}

impl<U: ToString, T: Iterator<Item=U>> Joinable for T {
    fn join(self, sep: &str) -> String {
        self.map(|x| x.to_string()).collect::<Vec<_>>().join(sep)
    }
}

fn main() {
    std::thread::Builder::new()
        .stack_size(104_857_600)
        .spawn(solve)
        .unwrap()
        .join()
        .unwrap();
}

#[derive(PartialEq, Eq, Copy, Clone, Hash, Debug, Default)]
struct Complex<T> {
    pub re: T, pub im: T,
}

impl<T> Complex<T> {
    pub fn new(re: T, im: T) -> Complex<T> {
        Complex { re: re, im: im }
    }
}

impl Complex<f64> {
    pub fn norm(&self) -> f64 {
        self.re.hypot(self.im)
    }

    pub fn abs(&self) -> f64 {
        self.norm().sqrt()
    }

    pub fn len(&self) -> f64 {
        self.abs()
    }

    pub fn rot(&self, rad: f64) -> Complex<f64> {
        *self * Self::polar(1.0, rad)
    }

    pub fn polar(abs: f64, rad: f64) -> Complex<f64> {
        Complex::new(abs * rad.cos(), abs * rad.sin())
    }
}

trait Num<T> : Mul<Output=T> + Div<Output=T> + Add<Output=T> + Sub<Output=T> + Copy {}

macro_rules! forward_ref_ref_binop {
    (impl $imp:ident, $method:ident) => {
        impl<'a, 'b, T: Clone + Num<T>> $imp<&'b Complex<T>> for &'a Complex<T> {
            type Output = Complex<T>;

            #[inline]
            fn $method(self, other: &Complex<T>) -> Complex<T> {
                self.clone().$method(other.clone())
            }
        }
    }
}

macro_rules! forward_ref_val_binop {
    (impl $imp:ident, $method:ident) => {
        impl<'a, T: Clone + Num<T>> $imp<Complex<T>> for &'a Complex<T> {
            type Output = Complex<T>;

            #[inline]
            fn $method(self, other: Complex<T>) -> Complex<T> {
                self.clone().$method(other)
            }
        }
    }
}

macro_rules! forward_val_ref_binop {
    (impl $imp:ident, $method:ident) => {
        impl<'a, T: Clone + Num<T>> $imp<&'a Complex<T>> for Complex<T> {
            type Output = Complex<T>;

            #[inline]
            fn $method(self, other: &Complex<T>) -> Complex<T> {
                self.$method(other.clone())
            }
        }
    }
}

macro_rules! forward_all_binop {
    (impl $imp:ident, $method:ident) => {
        forward_ref_ref_binop!(impl $imp, $method);
        forward_ref_val_binop!(impl $imp, $method);
        forward_val_ref_binop!(impl $imp, $method);
    };
}

impl<T> Add<T> for Complex<T>
where T: Add<Output=T> + Copy {
    type Output = Complex<T>;
    fn add(self, other: T) -> Complex<T> {
        Complex::new(self.re + other, self.im)
    }
}

impl<T> Add<Complex<T>> for Complex<T>
where T: Add<Output=T> + Add<Output=T> + Sub<Output=T> + Copy {
    type Output = Complex<T>;
    fn add(self, other: Complex<T>) -> Complex<T> {
        Complex::new(self.re + other.re, self.im + other.im)
    }
}

forward_all_binop!(impl Add, add);

impl<T> Sub<T> for Complex<T>
where T: Sub<Output=T> + Copy {
    type Output = Complex<T>;
    fn sub(self, other: T) -> Complex<T> {
        Complex::new(self.re - other, self.im)
    }
}

impl<T> Sub<Complex<T>> for Complex<T>
where T: Sub<Output=T> + Sub<Output=T> + Sub<Output=T> + Copy {
    type Output = Complex<T>;
    fn sub(self, other: Complex<T>) -> Complex<T> {
        Complex::new(self.re - other.re, self.im - other.im)
    }
}

forward_all_binop!(impl Sub, sub);

impl<T> Mul<T> for Complex<T>
where T: Mul<Output=T> + Copy {
    type Output = Complex<T>;
    fn mul(self, other: T) -> Complex<T> {
        Complex::new(self.re * other, self.im * other)
    }
}

impl<T> Mul<Complex<T>> for Complex<T>
where T: Mul<Output=T> + Add<Output=T> + Sub<Output=T> + Copy {
    type Output = Complex<T>;
    fn mul(self, other: Complex<T>) -> Complex<T> {
        Complex::new(self.re * other.re - self.im * other.im,
                     self.re * other.im + self.im * other.re)
    }
}

forward_all_binop!(impl Mul, mul);

impl<T> Div<T> for Complex<T>
where T: Div<Output=T> + Copy {
    type Output = Complex<T>;
    fn div(self, other: T) -> Complex<T> {
        Complex::new(self.re / other, self.im / other)
    }
}

impl<T> Div<Complex<T>> for Complex<T>
where T: Mul<Output=T> + Div<Output=T> + Add<Output=T> + Sub<Output=T> + Copy {
    type Output = Complex<T>;
    fn div(self, other: Complex<T>) -> Complex<T> {
        Complex::new((other.re*self.re + other.im*self.im) / (other.re*other.re + other.im*other.im),
                     (other.re*self.im - other.im*self.re) / (other.re*other.re + other.im*other.im))
    }
}

forward_all_binop!(impl Div, div);

use std::ops::*;

type Point = Complex<f64>;

fn f(a: Point, b: Point) -> (Point, Point, Point) {
    let p = a + (b - a) / 3.0;
    let q = p + (p - a).rot(std::f64::consts::PI / 3.0);
    let r = p + (p - a);
    (p, q, r)
}

fn rec(n: usize, a: Point, b: Point, res: &mut Vec<Point>) {
    if n > 0 {
        let (p, q, r) = f(a, b);
        rec(n - 1, a, p, res);
        res.push(p);
        rec(n - 1, p, q, res);
        res.push(q);
        rec(n - 1, q, r, res);
        res.push(r);
        rec(n - 1, r, b, res);
    }
}

fn solve() {
    let cin = stdin();
    let cin = cin.lock();
    let mut sc = Scanner::new(cin);

    let n = sc.read();
    let mut ans = vec![];
    let a = Point::new(0.0, 0.0);
    let b = Point::new(100.0, 0.0);
    ans.push(a);
    rec(n, a, b, &mut ans);
    ans.push(b);

    for &p in ans.iter() {
        println!("{:.10} {:.10}", p.re, p.im)
    }
}



Measured memory_bytes: 9084