#include <stdio.h>

const double cos60 = 0.5;
const double sin60 = 0.86602540;

void
koch(int n, double x1, double y1, double x2, double y2)
{
	/*      p4
	 * p1___/\___p2
	 *    p3  p5
	 */
#define kh(a, b) ((2 * a + b) / 3)
	double x3 = kh(x1, x2), y3 = kh(y1, y2);
	double x5 = kh(x2, x1), y5 = kh(y2, y1);
	double x4 = (x5 - x3) * cos60 - (y5 - y3) * sin60 + x3;
	double y4 = (x5 - x3) * sin60 + (y5 - y3) * cos60 + y3;
#undef kh

	if (n == 0) {
		printf("%.6f %.6f\n", x1, y1);
		return;
	}

	koch(n - 1, x1, y1, x3, y3);
	koch(n - 1, x3, y3, x4, y4);
	koch(n - 1, x4, y4, x5, y5);
	koch(n - 1, x5, y5, x2, y2);
	return;
}

int
main(void)
{
	koch(getchar() - '0', 0.0, 0.0, 100.0, 0.0);
	printf("100.0 0.0\n");
	return 0;
}
