data class Point(val x: Double, val y: Double)

fun main(args: Array<String>) {
    val depth = readLine()?.toInt() ?: 0
    val begin = Point(0.0, 0.0)
    val end = Point(100.0, 0.0)
    println(begin.toStr())
    koch(begin, end, depth)
    println(end.toStr())
}

fun koch(begin: Point, end: Point, depth: Int) {
    if (depth == 0) {
        return
    }
    val s = (begin * 2 + end) / 3
    val t = (begin + end * 2) / 3
    val u = Point((t - s).x * Math.cos(Math.PI / 3) - (t - s).y * Math.sin(Math.PI / 3) + s.x,
        (t - s).x * Math.sin(Math.PI / 3) + (t - s).y * Math.cos(Math.PI / 3) + s.y)
    koch(begin, s, depth - 1)
    println(s.toStr())
    koch(s, u, depth - 1)
    println(u.toStr())
    koch(u, t, depth - 1)
    println(t.toStr())
    koch(t, end, depth - 1)
}

operator fun Point.plus(other: Point): Point {
    return Point(this.x + other.x, this.y + other.y)
}

operator fun Point.minus(other: Point): Point {
    return Point(this.x -  other.x, this.y - other.y)
}

operator fun Point.times(num: Int): Point {
    return Point(this.x * num, this.y * num)
}

operator fun Point.div(num: Int): Point {
    return Point(this.x / num, this.y / num)
}

fun Point.toStr(): String {
    return "${this.x} ${this.y}"
}
