Problem:
Score : 900 points

Problem Statement

Snuke loves permutations. He is making a permutation of length N.

Since he hates the integer K, his permutation will satisfy the following:

Let the permutation be a_1, a_2, ..., a_N. For each i = 1,2,...,N, |a_i - i| \neq K.

Among the N! permutations of length N, how many satisfies this condition?

Since the answer may be extremely large, find the answer modulo 924844033(prime).

Constraints

2 ≦ N ≦ 2000

1 ≦ K ≦ N-1

Input

The input is given from Standard Input in the following format:

N K

Output

Print the answer modulo 924844033.

Sample Input 1

3 1

Sample Output 1

2

2 permutations (1, 2, 3), (3, 2, 1) satisfy the condition.

Sample Input 2

4 1

Sample Output 2

5

5 permutations (1, 2, 3, 4), (1, 4, 3, 2), (3, 2, 1, 4), (3, 4, 1, 2), (4, 2, 3, 1) satisfy the condition.

Sample Input 3

4 2

Sample Output 3

9

Sample Input 4

4 3

Sample Output 4

14

Sample Input 5

425 48

Sample Output 5

756765083

Solution in C++ (GCC 9.2.1) (judge verdict: Accepted)

#include <bits/stdc++.h>
using namespace std;

typedef long long int   ll;
typedef pair<ll, ll>    pll;
typedef pair<int, int>  pii;

#define all(x)          x.begin(), x.end()
#define kill(x)         return cout << x << endl, 0
#define X               first
#define Y               second
#define sep             ' '
#define endl            '\n'

ll pw(ll a, ll b, ll mod) {
    if (!b)    return 1;
    if (b & 1) return a * pw(a * a % mod, b / 2, mod) % mod;
    return pw(a * a % mod, b / 2, mod) % mod;
}

const ll N    = 2e3 + 10;
const ll MOD  = 924844033;
const ll INF  = 1e18;

ll n, k, F[2 * N][N], fact[N], ans;

int main() {
    ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);
    cin >> n >> k;
    fact[0] = 1;
    for (int i = 1; i < N; i++) {
        fact[i] = i * fact[i - 1] % MOD;
    }
    int len = n / k, t = 2 * (n % k), timer = 1;
    F[0][0] = 1;
    for (int i = 0; i < 2 * k; i++) {
        int l = (i < t ? len + 1 : len);
        for (int j = 0; j < l; j++) {
            for (int k = 0; k <= n; k++) {
                F[timer][k] = F[timer - 1][k];
                if (j)
                    F[timer][k] = (F[timer][k] + F[timer - 2][k - 1]) % MOD;
            }
            timer++;
        }
    }
    for (int i = 0; i <= n; i++) {
        ans += F[timer - 1][i] * fact[n - i] % MOD * pw(MOD - 1, i, MOD) % MOD;
        ans %= MOD;
    }
    cout << ans << endl;
    return 0;
}