eolymp
bolt
Try our new interface for solving problems
Problems

Pair the people

Pair the people

There are $n$ people in a party. Each person can either join dance as a single individual or as a pair with any other. Find the number of different ways in which all $n$ people can join the dance. \InputFile One integer $n~(1 \le n \le 10^5)$. \OutputFile Print the number of different ways in which all $n$ people can join the dance. Print the answer modulo $10^9 + 7$. \Example Let we have $n = 3$ people. They can dance in $4$ ways: $\{1, 2, 3\}, \{\{1, 2\}, 3\}, \{1, \{2, 3\}\}, \{\{1, 3\}, 2\}$.
Time limit 1 second
Memory limit 128 MiB
Input example #1
3
Output example #1
4