How to plant?
Very hard
Execution time limit is 1 second
Runtime memory usage limit is 64 megabytes
An organization is hosting an event for N pairs of twins, each pair consisting of a brother and a sister. During the banquet, they plan to seat everyone around a circular table. The seating must alternate between boys and girls, and no twin pair should sit next to each other.
How many distinct seating arrangements are possible under these conditions? Two arrangements are considered different if you cannot rotate one arrangement to exactly match the other.
Input
The input consists of a single line containing an integer N (0 ≤ N ≤ 500).
Output
Output a single line with the number of valid seating arrangements, given modulo 1000000009 (10^9+9).
Examples
Input #1
Answer #1
Submissions 119
Acceptance rate 3%