Expected LCP

아직 제출이 없습니다시간 제한1.5초메모리 제한256 MB

문제

Consider a sequence s_1s\_1, s_2s\_2, \ldots, s_ns\_n of nn infinite binary strings (that is, consisting only of zeros and ones), where each character of each string is generated uniformly at random independently from others. Denote f(s_1,s_2,,s_n)=max_1i<jnLCP(s_i,s_j),f(s\_1, s\_2, \ldots, s\_n) = \max\_{1 \le i < j \le n} LCP(s\_i, s\_j)\text{,} where LCPLCP is the maximum common prefix of two strings. Compute the expected value of f(s_1,s_2,,s_n)f(s\_1, s\_2, \ldots, s\_n).

입력

The only line of the input contains one integer nn (2n1042 \le n \le 10^4).

출력

Let the answer in the form of an irreducible fraction be P/QP / Q. Then output PQ1mod(109+7)P \cdot Q^{-1} \bmod (10^9 + 7). It is guaranteed that Qmod(109+7)0Q \bmod (10^9 + 7) \neq 0.

힌트

Note that the expected value is always finite, that is, Ef(s_1,,s_n)<\mathtt{E}f(s\_1, \ldots, s\_n) < \infty.  

In the second sample the answer is 73\frac{7}{3}.