Codeforces Round 921 (Div. 1)
C
Fractal Origami
Codeforces
2400
原题
← BD →
翻译中…

You have a square piece of paper with a side length equal to $1$ unit. In one operation, you fold each corner of the square to the center of the paper, thus forming another square with a side length equal to $\dfrac{1}{\sqrt{2}}$ units. By taking this square as a new square, you do the operation again and repeat this process a total of $N$ times.

翻译中…

image Performing operations for $N = 2$.

翻译中…

After performing the set of operations, you open the paper with the same side up you started with and see some crease lines on it. Every crease line is one of two types: a mountain or a valley. A mountain is when the paper folds outward, and a valley is when the paper folds inward.

翻译中…

You calculate the sum of the length of all mountain crease lines on the paper and call it $M$. Similarly, you calculate for valley crease lines and call it $V$. You want to find the value of $\dfrac{M}{V}$.

翻译中…

It can be proved that this value can be represented in the form of $A + B\sqrt{2}$, where $A$ and $B$ are rational numbers. Let this $B$ be represented as an irreducible fraction $\dfrac{p}{q}$, your task is to print $p*inv(q)$ modulo $999\,999\,893$ (note the unusual modulo), where $inv(q)$ is the modular inverse of $q$.

翻译中…

Input

翻译中…

Each test contains multiple test cases. The first line contains the number of test cases $t$ ($1 \leq t \leq 10^4$). Description of the test cases follows.

翻译中…

The only line of each test case contains an integer $N$ ($1 \leq N \leq 10^9$), the number of operations you perform on the square paper.

翻译中…

Output

翻译中…

For each test case, print on a new line the required answer.

翻译中…

Note

翻译中…

The blue lines in the given figures represent mountain crease lines, and the green lines represent valley crease lines.

翻译中…

imageimageCrease lines after $1$ operation $(\dfrac{M}{V} = 0)$.Crease lines after $2$ operations $(\dfrac{M}{V} = \sqrt{2} - 1)$.

翻译中…

样例

Input #1
3
1
2
3
Output #1
0
1
714285638
InputCopy OutputCopy
题目信息
题号
1924C
时间限制
1 s
内存限制
256 MB
标签
计算几何
数学
矩阵

题面与样例版权归 Codeforces 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。