Problem list
Log in
#coci00022 · COCI 2006/2007 Contest 4

Zbrka

Gold I 0.6 s 64 MB

Consider a sequence of $N$ integers where each integer between $1$ and $N$ appears exactly once.

A pair of numbers in the sequence is confused if the number that comes earlier in the sequence is larger than the later number.

The confusion of the sequence is the number of confused pairs in it. For example, the confusion of the sequence $3\ 2\ 1$ is $3$ because there are $3$ confused pairs: $(3, 2)$, $(3, 1)$ and $(2, 1)$.

Write a program that calculates the number of sequences of length $N$ whose confusion is exactly $C$.

Input

The first and only line of input contains two integers, $N$ ($1 \le N \le 1000$) and $C$ ($0 \le C \le 1000000000$).

Output

Output the number of sequences modulo $1000000000$.

Example 1

Input
10 1
Output
9

Example 2

Input
4 3
Output
6

Example 3

Input
9 13
Output
17957
Source
COCI 2006/2007 Contest 4
Appears in
Not part of a ladder, contest or set yet.
Accepted 1 Submissions 1 Acceptance 100% Solvers 1

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