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

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

void kock(int, Point, Point);

double rad = 60/180.0*M_PI;

int main(){

  int n;
  Point firstpoint;
  Point finalpoint;
  firstpoint.x = 0;
  firstpoint.y = 0;

  finalpoint.x = 100;
  finalpoint.y = 0;


  scanf("%d",&n);

  printf("%f %f\n",firstpoint.x,firstpoint.y);

  kock(n,firstpoint,finalpoint);

  printf("%f %f\n",finalpoint.x,finalpoint.y);

  return 0;
}

void kock(int n, Point p1, Point p2){

  Point s;
  Point t;
  Point u;

  if(n == 0) return;

  s.x = (2*p1.x+1*p2.x)/3;
  s.y = (2*p1.y+1*p2.y)/3;

  t.x = (1*p1.x+2*p2.x)/3;
  t.y = (1*p1.y+2*p2.y)/3;

  u.x = (double)(t.x - s.x)*cos(rad) - (t.y - s.y)*sin(rad) + s.x;

  u.y = (double)(t.x - s.x)*sin(rad) + (t.y - s.y)*cos(rad) + s.y;

  kock(n-1, p1, s);
  printf("%f %f\n",s.x,s.y);

  kock(n-1, s, u);
  printf("%f %f\n",u.x,u.y);

  kock(n-1, u, t);
  printf("%f %f\n",t.x,t.y);

  kock(n-1, t, p2);
}