let content = '';
process.stdin.resume();
process.stdin.setEncoding('utf8');
process.stdin.on('data', buf => {
  content += buf;
});

let numComp = 0;
process.stdin.on('end', () => {
  const depth = +content.trim();
  const points = kochCurve([0, 0], [100, 0], depth);
  const precision = 6;
  console.log(
    points
      .map(point => point.map(n => n.toFixed(precision)).join(' '))
      .join('\n')
  );
});

const rotate = ([x1, y1], [x2, y2], degree) => {
  const rad = degree / 180 * Math.PI;
  const cos = Math.cos(rad);
  const sin = Math.sin(rad);
  return [
    (x1 - x2) * cos - (y1 - y2) * sin + x2,
    (x1 - x2) * sin + (y1 - y2) * cos + y2,
  ]
};

const kochCurve = (start, end, depth) => {
  if (depth === 0) {
    return [start, end];
  }

  const [x1, y1] = start;
  const [x2, y2] = end;
  const s = [(2 * x1 + x2) / 3, (2 * y1 + y2) / 3];
  const t = [(x1 + 2 * x2) / 3, (y1 + 2 * y2) / 3];
  const u = rotate(t, s, 60);

  const points = [start, s, u, t, end];
  if (depth === 1) {
    return points;
  } else {
    const result = [];
    for (let i = 0; i < points.length - 1; i++) {
      let p = kochCurve(points[i], points[i + 1], depth - 1);
      if (i !== points.length - 2) {
        p = p.slice(0, -1);
      }

      result.push(...p);
    }

    return result;
  }
};
