#39. 计算机C13001第一次小组赛D题

计算机C13001第一次小组赛D题

说明

The Big Flag-raising

In the Maritime University , there is a tradition that is big flag-raising . 

At 5:50 in the morning , wearing uniforms and lining up for each student is a big headache . In order to improve the efficiency of collection and  save more sleep time .The school leadership decides to divide the specific area into N small areas of equal size.Now assume that we don’t consider the length  of the queue .The small areas will be seen as a straight line. In order to look more orderly, students in each small area are required to wear the same uniform .The adjacent small area should not wear the same uniform.Moreover, the head area and the tail area can’t wear the same uniform.There are some phalanxes(each phalanx occupies one small area) dressed in the specific uniform (one of three given kinds of uniform), and we want to know how many different permutation solutions(Assume that the number of phalanxes waring each kind of uniform is a certain number).

输入格式

The input will contain multiple test cases ,Each case will only contain a number N(1 <= N <= 50).

输出格式

Output the answer in a line.

样例

1
2
3
6