/* ?°?????????????
??\??????????????§????????????????????°??????????????§?????????????????§????????????????????§?????£????????????????????????????????§??????AIZU???????????????????????????????????????????????£???????????????????????°??????????????????????????????????????????????????¨?¨??????¢??§?§????????????°?????????????????????????????????

#include<stdio.h>
#define _USE_MATH_DEFINES
#include<math.h>

void koch(double p1x, double p1y, double p2x, double p2y, int n) {
	
	if (n == 0) return;
	
	double sx, sy, ux, uy, tx, ty, lx, ly;
	
	if (p1x > p2x)
	{
		lx = p1x - p2x;
		tx = p2x + lx/3.0;
		sx = p2x + 2.0*lx/3.0;
		if (p1y > p2y)
		{
			ly = p1y - p2y;
			ty = p2y + ly/3.0;
			sy = p2y + 2.0*ly/3.0;
			ux = (sx - tx)*cos(M_PI/3.0) - (sy - ty)*sin(M_PI/3.0) + sx;
			uy = (sx - tx)*sin(M_PI/3.0) - (sy - ty)*cos(M_PI/3.0) + sy;
		}
		else
		{
			ly = p2y - p1y;
			sy = p1y + ly/3.0;
			ty = p1y + 2.0*ly/3.0;
			ux = (sx - tx)*cos(M_PI/3.0) - (ty - sy)*sin(M_PI/3.0) + sx;
			uy = (sx - tx)*sin(M_PI/3.0) - (ty - sy)*cos(M_PI/3.0) + sy;
		}
	}
	else
	{
		lx = p2x - p1x;
		sx = p1x + lx/3.0;
		tx = p1x + 2.0*lx/3.0;
		if (p1y > p2y)
		{
			ly = p1y - p2y;
			ty = p2y + ly/3.0;
			sy = p2y + 2.0*ly/3.0;
			ux = (tx - sx)*cos(M_PI/3.0) - (sy - ty)*sin(M_PI/3.0) + sx;
			uy = (tx - sx)*sin(M_PI/3.0) - (sy - ty)*cos(M_PI/3.0) + sy;
		}
		else
		{
			ly = p2y - p1y;
			sy = p1y + ly/3.0;
			ty = p1y + 2.0*ly/3.0;
			ux = (tx - sx)*cos(M_PI/3.0) - (ty - sy)*sin(M_PI/3.0) + sx;
			uy = (tx - sx)*sin(M_PI/3.0) - (ty - sy)*cos(M_PI/3.0) + sy;
		}
	}
	koch(p1x, p1y, sx, sy, n - 1);
	printf("%.8f %.8f\n", sx, sy);
	koch(sx, sy, ux, uy, n - 1);
	printf("%.8f %.8f\n", ux, uy);
	koch(ux, uy, tx, ty, n - 1);
	printf("%.8f %.8f\n", tx, ty);
	koch(tx, ty, p2x, p2y, n - 1);
}

int main(void) {
	double p1x = 0.0, p1y = 0.0, p2x = 100.0, p2y = 0.0;
	int n;
	scanf("%d", &n);
	
	printf("%.8f %.8f\n", p1x, p1y);
	koch(p1x, p1y, p2x, p2y, n);
	printf("%.8f %.8f\n", p2x, p2y);
	
	return 0;
}

???????????§?§????????????°????????§??????
??\??????????§????????????°????????§??????
*/

#include <bits/stdc++.h>
using namespace std;
int n;
class Point{
  public:
  double x;
  double y;
  Point(){}
  Point(double _x, double _y){
    x = _x;
    y = _y;
  }
  Point operator+(const Point &p)const{
    Point res;
    res.x = x + p.x; res.y = y + p.y;
    return res;
  }
  double length(){
    return sqrt(x*x+y*y);
  }
};
 
void func(int i, Point l, Point r){
  if(i == n) return;
  Point s, t, u;
  Point sum = r+l;
  s = Point((l.x * 2.0 + r.x)/3.0, (2*l.y + r.y)/3.0);
  t = Point((l.x + 2*r.x)/3.0, (l.y + 2*r.y)/3.0);
  u = Point(cos(M_PI/3)*(t.x - s.x) - sin(M_PI/3)*(t.y - s.y) + s.x,
            sin(M_PI/3)*(t.x - s.x) + cos(M_PI/3)*(t.y - s.y) + s.y
           );
  func(i+1, l, s);
  printf("%.10f %.10f\n", s.x, s.y);
  func(i+1, s, u);
  printf("%.10f %.10f\n", u.x, u.y);
  func(i+1, u, t);
  printf("%.10f %.10f\n", t.x, t.y);
  func(i+1, t, r);
  return;
}
 
int main(void){
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> n;
  Point p1(0, 0), p2(100, 0);
  printf("%.10f %.10f\n", p1.x, p1.y);
  func(0, p1, p2);
  printf("%.10f %.10f\n", p2.x, p2.y);
 
  return 0;
}

Measured memory_bytes: 3160