#P4484. Expected Length of Longest Increasing Subsequence
Expected Length of Longest Increasing Subsequence
Expected Length of Longest Increasing Subsequence
Given a random permutation of length , compute the expected value of the length of its longest increasing subsequence (LIS). Formally, let $$E = \frac{1}{n!}\sum_{\pi \in S_n} \mathrm{LIS}(\pi),$$ where is the set of all permutations of . To avoid issues with precision, output the value of modulo .
Note: In this problem, is small (for example, ) so that it is feasible to iterate over all permutations.
inputFormat
Input consists of a single line containing one integer (), representing the length of the permutation.
outputFormat
Output a single integer — the expected length of the longest increasing subsequence modulo .
sample
1
1