Define a random linear recursive sequence (RLRS) as a sequence of random variables a_0,a_1,… which is generated as follows. First, a_0=1. Then, for every n starting from 1, choose integers i and j independently and equiprobably from \[0;n−1], and set a_n=a_i+a_j (note that at this moment, the values of a_0, …, a_n−1 are already determined).
For example, a_1=a_0+a_0=2, and a_2 is equally likely to be a_0+a_0, a_0+a_1, a_1+a_0 and a_1+a_1, thus it has 25% probability to be 2, 50% to be 3 and 25% to be 4. After that, a_3 is equiprobably chosen from a_0+a_0, a_0+a_1, a_0+a_2, a_1+a_0, a_1+a_1, a_1+a_2, a_2+a_0, a_2+a_1, a_2+a_2; and so on.
You are to determine the variance of n-th term of RLRS.
The variance of a random variable X is defined as Var(X)=E(X−E(X))2 (here E(X) means expectation or mean value of the random variable X).
The first line of input contains the integer n (0≤n≤106).
Let the variance of a_n be a rational number equal to U/V when cancelled to lowest terms (that is, U and V are integers, V>0 and the greatest common divisor of U and V is 1). Output the number X=(U⋅V−1)mod(109+7). That is, X should satisfy the congruence VX≡U modulo (109+7). It is guaranteed that such X exists and is the only root of this equation with 0≤X<109+7.
a_1 is always equal to 2, so Var(a_1)=0.
Var(a_2)=21.
Var(a_5)=36263.