Bounce Bounce Bounce
Time limit3sMemory limit512 MB
Count laser directions that bounce off a circular mirror exactly N times and return to the start for the first time.
- Level
Medium7 of 10
- Topics
- Math, Number theory, Geometry, Combinatorics
- Solved
- No attempts yet
Problem
Fidel built a circular ring. Its inner boundary is made of reflective material, and a laser sits at one point of the boundary. Fidel wants to aim the laser so that the beam bounces off the boundary exactly times and then returns to its starting point for the first time. How many initial directions can he choose?
The angle of incidence equals the angle of reflection. See the image below. The position of the laser in the image is only for demonstration.

Input
The first line contains , the number of test cases.
Each test case is a single line holding one integer .
Constraints
Output
For each test case, print on its own line the number of initial directions that make the beam bounce exactly times and then return to the starting point for the first time.
Hint
For there are exactly four ways to bounce four times and come back to the starting point. The figure below shows all of them.

For there are exactly two ways to bounce three times and come back to the starting point.
