URI Online Judge | 1760

Koch Snowflake

By Michele Selivon, URI BR Brazil

Timelimit: 1

Lapland is a quiet and very cold place. There is not much to do there after Christmas (where the elves work diligently in Santa's toy factory). The marasmus has made the elf Tod review research about the only thing that could be seen in Lapland: Snow.

In their studies, Tod found very interesting things about the snowflakes. How did incessant search the sites for information about snowflakes, eventually finding links that talk about a theory called Koch Snowflake.

Tod found the very interesting theory because the Koch snowflake is a fractal that is obtained from an equilateral triangle. Then divide each of its sides into three equal parts and added, from each middle section, a new equilateral triangle of side equal to 1/3 of the measure on the side of the initial triangle.

At each iteration fractal perimeter and after n iterations increases, it tends to infinity but remains smaller area than the area of the circle surrounding the original triangle. Thus, an infinitely long line is surrounded by a finite area.

Based on this information and knowing that the area of a triangle is equal to l2 √3 /4 (where l is equal to measure the length of a side of the equilateral triangle) your task is to help Tod find the area of a Koch snowflake based on the measurement of the length of side of the equilateral triangle given.


The input has several test cases and consists of an integer l (1mm ≤ l ≤ 1000mm) that represents a measure of the length of one side of the equilateral triangle. The end of input is determined by EOF.


The output should show the value Koch Snowflake area with two decimal places.

Input Sample Output Sample