#P7278. 纯洁憧憬

纯洁憧憬

Description

Given a permutation of order nn p1,,pnp_1,\dots,p_n and an interval [l,r][l,r], if $\max\limits_{l\le i\le r} p_i - \min\limits_{l\le i\le r} p_i = r - l$, then [l,r][l,r] is called a consecutive segment.

For a consecutive segment [l,r][l,r], if it satisfies 2rl+1<n2 \le r - l + 1 < n, then [l,r][l,r] is called a non-trivial consecutive segment.

The boy’s thoughts can be abstracted as a permutation that has at least one non-trivial consecutive segment with length greater than kk.

The boy will give n,kn,k and ask you how many permutations of order nn can be the boy’s thoughts. Output the answer modulo 109+710^9 + 7.

Input Format

The first line contains two positive integers n,kn,k.

Output Format

One line containing one non-negative integer, representing the answer.

3 2
0
4 2
20

Hint

For 20%20\% of the testdata, n10n \le 10.
For 100%100\% of the testdata, 1k<n4001 \le k < n \le 400.

Sample Explanation

For the second sample, there are 44 permutations that do not satisfy the condition:

  1. [2,1,4,3][2,1,4,3].
  2. [2,4,1,3][2,4,1,3].
  3. [3,4,1,2][3,4,1,2].
  4. [3,1,4,2][3,1,4,2].

The other 4!4=204!-4=20 cases all satisfy the condition and can be the boy’s thoughts.

Translated by ChatGPT 5