'use strict';

const main = input => {
  // console.log(input, '\n---'); // for debug
  const n = Number(input);
  const p1 = {
    x: 0,
    y: 0,
  };
  const p2 = {
    x: 100,
    y: 0,
  };
  console.log(p1.x, p1.y);
  koch(n, p1, p2);
  console.log(p2.x, p2.y);
};

function koch(n, p1, p2) {
  if (n === 0) {
    return;
  }
  const r = toRadians(60);

  const s = { x: (2 * p1.x + 1 * p2.x) / 3, y: (2 * p1.y + 1 * p2.y) / 3 };
  const t = { x: (1 * p1.x + 2 * p2.x) / 3, y: (1 * p1.y + 2 * p2.y) / 3 };
  const u = {
    x: (t.x - s.x) * Math.cos(r) - (t.y - s.y) * Math.sin(r) + s.x,
    y: (t.x - s.x) * Math.sin(r) + (t.y - s.y) * Math.cos(r) + s.y,
  };
  koch(n - 1, p1, s);
  console.log(s.x, s.y);
  koch(n - 1, s, u);
  console.log(u.x, u.y);
  koch(n - 1, u, t);
  console.log(t.x, t.y);
  koch(n - 1, t, p2);
}

function toRadians(deg) {
  return deg * (Math.PI / 180);
}

main(require('fs').readFileSync('/dev/stdin', 'utf8'));

