P6307 "Wdsr-1" Philosopher’s Stone

Background

Patchouli Knowledge is a witch who is good at magic, and refining the Philosopher’s Stone is her daily task.

Description

Patchouli sets up an equilateral triangular lattice with side length $k-1$ ($k$ points on each side). On each point, **you can and must** place exactly one elemental stone. ![](https://cdn.luogu.com.cn/upload/image_hosting/h84oo82e.png) In the demon world, an equilateral triangle is considered the most beautiful and stable shape. Therefore, **if and only if** the **three** elemental stones placed on the lattice **form an equilateral triangle**, they can be fused into one Philosopher’s Stone. Patchouli defines that if she **randomly** selects three points in the lattice of side length $k-1$ and places elemental stones on them, then the probability that these three stones can be fused into a Philosopher’s Stone is called $P_k$. ($P_1=0, P_2=1$) Now, to challenge your wisdom, Patchouli wants you to compute $$\sum_{k=m}^{+\infty}P_k$$ where $m$ is a given integer.

Input Format

One line containing one integer $m$.

Output Format

Output one decimal number on one line, representing the required answer. **You must keep $5$ significant digits and use scientific notation.** Examples: If the answer is ``0.0123``, you should output ``1.2300x10^-2``. If the answer is ``1.2345``, you should output ``1.2345x10^0``.

Explanation/Hint

#### Constraints $$\def\arraystretch{1.5}\begin{array}{|c|c|c|}\hline Subtasks & \textbf{ID} & m \\ \hline 1 & [1,15] & \le 100\\\hline 2 & [16,35] & \le 500\\\hline 3 & [36,40] & \le 10^3\\\hline 4 & [41,45] & \le 10^4\\\hline 5 & [46,50] & \le 65535\\\hline \end{array}$$ Here, $[l,r]$ means the test points with IDs $l,l+1,\cdots,r-1,r$. - In addition, it is guaranteed that $m\ge 1$. Translated by ChatGPT 5