You are on page 1of 2

# Problem 6 : Saving The Tree of Souls

(150 points)

Colonel Miles Quaritch is about to attack Pandora to drive away the colony
of the Na’vi from the region near the Unobtanium mines. And it is upto our
hero Jake Sully to devise a strategy to save the Na’vi. Now, it is known that
the Pandoran ecology forms a vast neural network spanning the entire plane-
tary surface into which the Na’vi and other creatures can connect. There is a
collection of special points in this neural network, which, if destroyed, would
kill the Tree of Souls, thus spelling disaster for the Na’vi. It is upto Jake Sully
and co. to find out these special points and protect them at all cost.

Some points in the neural network have a collection of neural whips. Let N
be the number of whips at a point. First, we find out in how many ways N can
be written as a sum of integers such that each integer is of the form 3k + 2. This
value is known as the strength of the point. However, the sums are ordered,
that is N = a1 + a2 is not the same as N = a2 + a1 . If the strength of the point
exceeds a certain threshold, then the point is a special point. Jake and Neytiri
have listed a set of points which can possibly be special points, and wish to
compute the strength of the points. Being lousy at mathematics and program-
ming, they have asked you, an ace coder, to solve this problem for them. Can
you help our heroes save the Tree of Souls?

Input format:

First line contains a positive integer with the number of possible special points
(P).
The next P lines contain one integer N denoting the number of neural whips at
a point.

Output format:

For each point, output one line containing the strength of the point modulo
10000.

Sample Input:
2
4

1
7

Sample Output:
1
2