#K94672. Unique Connections
Unique Connections
Unique Connections
Given a positive integer \(n\) representing the number of participants, compute the number of unique sets of connections formed after all participants have attended. The result should be calculated modulo \(10^9+7\).
The problem can be formulated using a recurrence relation. Let \(dp[1] = 1\) and for \(n \ge 2\),
[ dp[n] = dp[n-1] \times (2n - 3) \pmod{10^9+7} ]
For example:
- For \(n = 1\), the answer is 1.
- For \(n = 3\), the answer is 3.
- For \(n = 4\), the answer is 15.
- For \(n = 5\), the answer is 105.
Your task is to implement a solution that reads the input from standard input (stdin) and writes the output to standard output (stdout).
inputFormat
The input consists of a single positive integer \(n\) (\(1 \le n \le 10^6\)) representing the number of participants.
This will be given as a single line from standard input.
outputFormat
Output a single integer which is the number of unique sets of connections modulo \(10^9+7\).
The output should be printed to standard output.
## sample1
1