SPOJTEST - Glenbow Museum

no tags 

NOTE: This problem can only be solved using ICK language.

 

The famous Glenbow Museum in Calgary is Western Canada's largest museum, with exhibits ranging from art to cultural history to mineralogy. A brand new section is being planned, devoted to brilliant computer programmers just like you. Unfortunately, due to lack of space, the museum is going to have to build a brand new building and relocate into it.

The size and capacity of the new building differ from those of the original building. But the floor plans of both buildings are orthogonal polygons. An orthogonal polygon is a polygon whose internal angles are either 90o or 270o. If 90o angles are denoted as R (Right) and 270o angles are denoted as O (Obtuse) then a string containing only R and O can roughly describe an orthogonal polygon. For example, a rectangle (Figure 1) is the simplest orthogonal polygon and it can be described as RRRR (the angles are listed in counter-clockwise order, starting from any corner). Similarly, a cross-shaped orthogonal polygon (Figure 2) can be described by the sequence RRORRORRORRO, RORRORRORROR, or ORRORRORRORR. These sequences are called angle strings.

Of course, an angle string does not completely specify the shape of a polygon -- it says nothing about the length of the sides. And some angle strings cannot possibly describe a valid orthogonal polygon (RRROR, for example).

To complicate things further, not all orthogonal polygons are acceptable floor plans for the museum. A museum contains many valuable objects, and these objects must be guarded. Due to cost considerations, no floor can have more than one guard. So a floor plan is acceptable only if there is a place within the floor from which one guard can see the entire floor. Similarly, an angle string is acceptable only if it describes at least one acceptable polygon. Note that the cross-shaped polygon in Figure 2 can be guarded by someone standing in the center, so it is acceptable. Thus the angle string RRORRORRORRO is acceptable, even though it also describes other polygons that cannot be properly guarded by a single guard.

Help the designers of the new building determine how many acceptable angle strings there are of a given length.

Input

The input file contains exactly 42 test cases. Each test case consists of a line containing a positive integer L(1<= L <=500), which is the desired length of an angle string. There won't be any extra whitespace in the input.

Output

For each test case, print a line with the number of acceptable angle strings of the given length.

Example

Input:
4
6
[and 40 test cases more]

Output:
1
6
[and 40 test cases more]

Note: Anyone who solves this problem will get 3 points because the only language available is Intercal. Any rejected submissions will be shown as "Wrong Answer" instead of different verdicts like WA, RE and TLE to make this problem a little more difficult.

The input has been corrected on Sep 27. 2010. Now it contains no extra '\r' at the end of each line.


hide comments
Jared Deckard: 2014-12-11 20:35:08

I count at least 12 valid angle strings for 6...
ORRRRR makes 6 unique rotations, plus their inverses.

Oh, intercal? nevermind


Added by:Fudan University Problem Setters
Date:2008-07-01
Time limit:1s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:ICK