SP2152 FRACTAL - Hilbert Curve

Description

The Hilbert Mole is a small and very rare mole. The first and only specimen was found by David Hilbert at his backyard. This mole lives in a huge burrow under the ground, and the border of this burrow forms a Hilbert curve of n-th order (H $ _{n} $ ). ![](https://cdn.luogu.com.cn/upload/vjudge_pic/SP2152/123861f388566636adc0287ed600e2b420a8c5de.png)Figure 1. Hilbert curves, order 1 to 4. Hilbert curves can be defined as follows. H $ _{1} $ is a unit square with open top side (figure 1(a)), H $ _{n} $ consists of four copies of H $ _{n-1} $ : bottom left and bottom right are copied without changes, top left is rotated 90 $ ^{o} $ counter-clockwise and top right is rotated 90 $ ^{o} $ clockwise. These small copies are connected by three segments of unit length (figure 1(b),(c),(d)). ![](https://cdn.luogu.com.cn/upload/vjudge_pic/SP2152/9acf263154d2789edc524f3998fba42a1f2f1f90.png)Figure 2. Burrow, filled with water. Trying to exterminate the mole, Mr. Hilbert fills the burrow with water (figure 2). But air inside the burrow prevents water from filling it entirely. In this problem we suppose that air and water are incompressible and cannot leak throw the borders of the burrow. Your task is to find the total area of the burrow, filled with water. Note that water can flow over the obstacle only when its level is strictly higher. See examples on figure 3 for further clarification. ![](https://cdn.luogu.com.cn/upload/vjudge_pic/SP2152/cc723ad428b3c52d41d190959923b095f391266e.png)Figure 3. More examples of filled burrows.

Input Format

Multiple test cases. For each test case: The first line of the input file contains two integer numbers: n and alpha - order of Hilbert curve and slope angle of surface in degrees (1

Output Format

For each test case: The first line of the output file must contain a single real number - the total area of the burrow, filled with water. The relative error of the answer must not exceed 10 $ ^{-6} $ .