#include<stdio.h>
#include<stdlib.h>
#include<math.h>

#define PI 3.1415926535

typedef struct{
  double x;
  double y;
}Point;

void KochCurve(Point,Point,int);

int main(void){
  int n;
  Point p1={0,0};
  Point p2={100,0};

  scanf("%d", &n);

  printf("%.8f %.8f\n", p1.x, p1.y);
  KochCurve(p1,p2,n);
  printf("%.8f %.8f\n", p2.x, p2.y);

  return 0;
}

void KochCurve(Point p1, Point p2, int n){
  Point p3,p4,p5;

  if(n==0) return;

  p3.x=(2*p1.x+p2.x)/3.0;
  p3.y=(2*p1.y+p2.y)/3.0;
  p4.x=(p1.x+2*p2.x)/3.0;
  p4.y=(p1.y+2*p2.y)/3.0;
  p5.x=(p4.x-p3.x)*cos(PI/3)-(p4.y-p3.y)*sin(PI/3)+p3.x;
  p5.y=(p4.x-p3.x)*sin(PI/3)-(p4.y-p3.y)*cos(PI/3)+p3.y;

  KochCurve(p1,p3,n-1);
  printf("%.8f %.8f\n", p3.x, p3.y);
  KochCurve(p3,p5,n-1);
  printf("%.8f %.8f\n", p5.x, p5.y);
  KochCurve(p5,p4,n-1);
  printf("%.8f %.8f\n", p4.x, p4.y);
  KochCurve(p4,p2,n-1);

  return;
}