Under construction

Still being built. Things may change

Triangle

Time limit1sMemory limit64 MB

Summary
Recursively subdivide a triangle into three corner triangles N-1 times and print the resulting ASCII fractal.
Level

Easy3 of 10

Topics
Divide and conquer, Recursion, Simulation
Solved
No attempts yet

Problem

After thinking about the meaning of life for a long time, Adrijan decided to become a painter. Years spent on mathematics left their mark, so his first work is a single triangle. Mirko, the director of the gallery, refused to exhibit the picture, which surprised Adrijan a lot. He decided the problem is a lack of detail, so he will decorate the picture and try the galleries again.

Adrijan first picks a natural number NN and calls the triangle he drew at the start interesting.

He then repeats the following step N−1N-1 times. In every interesting triangle he joins the midpoints of the three sides. That splits the triangle into four smaller triangles: three corner triangles and one central triangle. After the step, the interesting triangles are the three corner triangles it produced.

Write a program that draws his finished picture.

Input

The first and only line contains a natural number NN (1≤N≤101 \le N \le 10).

Output

Print Adrijan's picture after the decoration.

  • The only characters you may use in the output are /, \, _, and ..
  • The picture has 2N2^N lines and every line fits in 2N+12^{N+1} columns. A column that no triangle passes through holds a ..
  • The smallest triangle takes two lines. It has two characters on each of its slanted sides and four characters on its horizontal side, so it is the same size as the picture for N=1N = 1.
  • Do not print the . characters left at the end of a line. The last character of every line is therefore \.
  • Do not print blank lines.

Examples3

  1. Example 1

    Input
    1
    
    Expected output
    ./\
    /__\
    
  2. Example 2

    Input
    2
    
    Expected output
    .../\
    ../__\
    ./\../\
    /__\/__\
    
  3. Example 3

    Input
    3
    
    Expected output
    ......./\
    ....../__\
    ...../\../\
    ..../__\/__\
    .../\....../\
    ../__\..../__\
    ./\../\../\../\
    /__\/__\/__\/__\