Nice partition

In this problem, we say that a partition of the numbers {1,,n}\{1, \dots, n\} is nice if

Additionally, we only consider partitions that are qualitatively different.

For instance, for n=5n = 5 we only have one nice partition: {{1,2},{3,4,5}}\{\{1, 2\}, \{3, 4, 5\}\}. Notice that {{1,2,3,4,5}}\{\{1, 2, 3, 4, 5\}\} would not fulfil the first property above, {{2},{1,3,4,5}}\{\{2\}, \{1, 3, 4, 5\}\} would not fulfil the second property above, while {{2,3},{1,4,5}}\{\{2, 3\}, \{1, 4, 5\}\} would be basically the same partition as the only one given.

Given nn, how many nice partitions do we have?

Input

Input consists of several cases, each one with an nn between 1 and 31043 \cdot 10^4.

Output

For every nn, print the number of nice partitions of {1,,n}\{1, \dots, n\} modulo 108+710^8 + 7.

Problem information

Author: Xavier Molinero

Generation: 2026-01-25T10:15:23.161Z

© Jutge.org, 2006–2026.
https://jutge.org