At the beginning of time, there were only two circles in the circleverse (a universe where everyone is a circle). They are called the first generation of the circleverse and known as and , where denotes a circle with radius .
Each year, a new generation of the circleverse is created from the previous one. Each generation of the circleverse consists of all circles in it positioned side by side on a straight line. To create the new generation, each pair of adjacent circles of the previous generation creates a new circle and positions it between them. The new circle gets a radius equal to the sum of the two adjacent circles it is created from. The figure below shows the first three generations of a circleverse.
Doctor Strange, the master of mystic arts, has explored the multiverse and found two circleverses and . First generation of consists of circles and . On the other hand, both circles of the first generation of are . Doctor Strange wants to use and to create a new generation of circles he calls super-circles.
Let,
= th circle of the th generation of
= th circle of the th generation of
= number of circles in the th generation of a circleverse
Doctor Strange will create super-circles initially. The th super-circle will be created from and and it will be . After that, Doctor Strange will destroy all unstable super-circles. A super-circle is unstable if or . To destroy these unstable super-circles, he needs to summon enough energy from the multiverse. The amount of the energy required depends on the number of unstable super-circles.
Since Doctor Strange is the master of mystic arts, not mathematics, he needs your help to calculate the number of unstable super-circles. Given , calculate the number of the unstable super-circles Doctor Strange will have to destroy.
First line of the input will contain an integer , the number of test cases.
Each of the next lines will contain an integer , indicating that circles from the th generation will be used to create super-circles.
For each test case, print the number of the unstable super-circles modulo in a single line.
Input | Output |
---|---|
5 1 3 5 12 100 | 0 0 6 2002 988182602 |