Sum of squares#2414

Sum of squares

1 second
128 megabytes
Medium

Let be the total number of sequences consisting only of and , whose sum is equal to .

For a given integer , find the sum of the squares of the numbers for all i = 1, \ldots, n. Print the result modulo 10^9 + 9.

Input

One positive integer (1 \le n \le 10^{18}).

Output

Print the value of (U_1^2 + U_2^2 + \ldots + U_n^2) \bmod (10^9 + 9).

Examples

Example 1

Loading
Loading