A sequence of integers from to is said to be zig zag if the sequence contains each integer exactly once and, indexing from one, every element at an even index is greater than the preceding one, and every element at an odd index is less than the preceding one.
For example:
Sequence | |
---|---|
is zig zag | |
is zig zag | |
is NOT zig zag (the fourth element is less than the third element) |
Input Specification
The input will contain test cases. Each test case has one line with the integer .
For the first four test cases in the file, . For the first seven cases, .
Output Specification
For each test case, output the number of unique zig zag sequences possible for that value of , modulo or .
"Modulo " means that if the answer is you should output because that's the remainder of divided by .
Sample Input
3
4
5
Sample Output
2
5
16
Note: Only cases are shown in this sample.
Educational Computing Organization of Ontario - statements, test data and other materials can be found at ecoocs.org
Comments