const koch = (n, p1, p2) => {
  if (n === 0) return;

  const th = Math.PI * 60.0 / 180.0;

  const s = {
    x: (2.0 * p1.x + 1.0 * p2.x) / 3.0,
    y: (2.0 * p1.y + 1.0 * p2.y) / 3.0,
  };
  const t = {
    x: (1.0 * p1.x + 2.0 * p2.x) / 3.0,
    y: (1.0 * p1.y + 2.0 * p2.y) / 3.0,
  };
  const u = {
    x: (t.x - s.x) * Math.cos(th) - (t.y - s.y) * Math.sin(th) + s.x,
    y: (t.x - s.x) * Math.sin(th) + (t.y - s.y) * Math.cos(th) + 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);
};

const proc = (nStr) => {
  const p1 = {x: 0, y:0};
  const p2 = {x: 100, y:0};

  console.log(`${p1.x} ${p1.y}`);
  koch(Number(nStr), p1, p2);
  console.log(`${p2.x} ${p2.y}`);
};

let inputStr = '';
process.stdin.on('data', (input) => { inputStr += input; });
process.stdin.on('data', () => { proc(inputStr); });
