Problem list
Log in
#coci00552 · COCI 2019/2020 Contest 5

Zapina

Gold II 1.0 s 512 MB

There is a total of $N$ young programmers which are preparing for the second part of competitive season during a winter camp in Krapina Zagreb. Mr. Malnar, a big promoter of order, discipline and hard work, told the programmers to form a line and gave each of them a certain number (possibly zero) tasks. He gave away a total of N different tasks and he knows that the $i$-th programmer in line will be happy if they got exactly $i$ tasks. In how many different ways could Mr. Malnar give out the tasks in such a way that at least one programmer was happy? Two ways of giving out the tasks are considered different if there exists a programmer and a task such that in one way that programmer received that task while in the other one they didn’t.

Input

The first line contains an integer $N$ ($1 \le N \le 350$) from task description.

Output

Output the sought number of ways modulo $10^{9} + 7$.

Constraints

Subtask Score Constraints 1 22 $1 \le N \le 7$ 2 33 $1 \le N \le 20$ 3 55 No additional constraints.

Example 1

Input
1
Output
1

Example 2

Input
2
Output
3

Example 3

Input
314
Output
192940893

Clarification of the second example: Ways of giving out the tasks in which at least one programmer is happy are:

  1. First task to first programmer, second task to the second one.
  2. Second task to the first programmer, first task to the second one.
  3. Both tasks to the second programmer.
Source
COCI 2019/2020 Contest 5
Appears in
Not part of a ladder, contest or set yet.
Accepted 0 Submissions 0 Acceptance 0% Solvers 0

Discussion

Threads about this problem. Spoilers are collapsed; wrap hints in ||double bars||.

No discussion yet. Start a thread if something here needs explaining.

Recent submissions Open with filters
Code