P r o b l e m \mathrm{Problem} Problem
Last summer Peter was at his granny's in the country, when a wolf attacked sheep in the nearby forest. Now he fears to walk through the forest, to walk round the forest, even to get out of the house. He explains this not by the fear of the wolf, but by a strange, in his opinion, pattern of the forest that has n n n levels, where n n n is an even number.
In the local council you were given an area map, where the granny's house is marked by point H H H , parts of dense forest are marked grey (see the picture to understand better).
After a long time at home Peter decided to yield to his granny's persuasions and step out for a breath of fresh air. Being prudent, Peter plans the route beforehand. The route, that Peter considers the most suitable, has the following characteristics:
- it starts and ends in the same place — the granny's house;
- the route goes along the forest paths only (these are the segments marked black in the picture);
- the route has positive length (to step out for a breath of fresh air Peter has to cover some distance anyway);
- the route cannot cross itself;
- there shouldn't be any part of dense forest within the part marked out by this route;
You should find the amount of such suitable oriented routes modulo 1000000009.
The example of the area map for n = 12 n=12 n=12 is given in the picture. Since the map has a regular structure, you can construct it for other n n n by analogy using the example.
给定一个有规律的金字塔形的图形,其中一部分三角形是黑色的(见图)。 要求统计所有从最顶端出发,沿着黑线走了一条闭合简单路径又回到最顶端,且没有任何黑色三角形在闭合简单路径内部的路径条数
S o l u t i o n \mathrm{Solution} Solution
为了叙述方便,我们不妨将第 2 i − 1 2i-1 2i−1和第 2 i 2i 2i层看作第 i i i层。
当我们只经过第一层时,顺时针和逆时针各有 5 5 5 种方法,即 10 10 10 种。
我们设 a n