Sauron's Army

Statement:

After the last war of the five armies, Sauron wants to make his army more powerful. For that he has found an error that needs to be corrected, the soldiers are tired of seeing the same preceding soldier in the line. Then he needs to know in how many ways he can arrange each line so that no soldier sees the same preceding soldier of the last war. Given the line of N soldiers compute the amount of arrangements that meet the above rules.

Input:

The only line of input contains an integer N (1 ≤ N ≤ 500).

Output:

Print a line with the amount of arrangements mod 109 + 7 (1000000007).

Example input:
3
Example output:
3
Explanation

For the sample input the possibles permutations are [1,2,3], [1,3,2], [2,1,3], [2,3,1], [3,1,2], [3,2,1]. If the first permutation was used in the last war then the possible permutations that meet the rules are [1,3,2], [2,1,3], [3,2,1].

Time and memory limit:

  • 1s
  • 64MB

Problem source: Caribbean Online Judge