Codeforces Round 921 (Div. 1) |
---|

Finished |

Virtual contest is a way to take part in past contest, as close as possible to participation on time. It is supported only ICPC mode for virtual contests.
If you've seen these problems, a virtual contest is not for you - solve these problems in the archive.
If you just want to solve some problem from a contest, a virtual contest is not for you - solve this problem in the archive.
Never use someone else's code, read the tutorials or communicate with other person during a virtual contest.

geometry

math

matrices

*2400

No tag edit access

The problem statement has recently been changed. View the changes.

×
C. Fractal Origami

time limit per test

1 secondmemory limit per test

256 megabytesinput

standard inputoutput

standard outputYou 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.

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.

Example

Input

3123

Output

0 1 714285638

Note

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

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

Codeforces (c) Copyright 2010-2024 Mike Mirzayanov

The only programming contests Web 2.0 platform

Server time: Apr/18/2024 10:51:31 (h1).

Desktop version, switch to mobile version.

Supported by

User lists

Name |
---|