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++14 (GCC 5.4.1) (judge verdict: Accepted)

#include <bits/stdc++.h>

#define maxn 2010
#define ll long long
#define mod 924844033

using namespace std;

int wsk;
ll dp[maxn][maxn][3], silnia[maxn];

void calculate_dp (int n, int k)
{
	dp[0][0][0]=1;
	for(int i = 1; i <= 2*k; ++i)
	{
		for (int j = i; j<=n; j+=2*k)
		{
			++wsk;
			silnia[wsk]=(silnia[wsk-1]*((ll)wsk))%mod;
			for (int x = 1; x<=wsk; ++x)
			{
				dp[wsk][0][0] = 1;
				if(wsk == 1)
				{
					if (j + k <=n)
						dp[wsk][1][1] = 1;
				}
				else if (i==j)
				{
					if(j - k <= 0)
					dp[wsk][x][0] = (dp[wsk-1][x][0] + dp[wsk-1][x][1])%mod;
					else
					dp[wsk][x][0] = (dp[wsk-1][x][0] + dp[wsk-1][x][1] + dp[wsk-1][x-1][0] + dp[wsk-1][x-1][1])%mod;
					if(j + k <= n)
					dp[wsk][x][1] = (dp[wsk-1][x-1][0] + dp[wsk-1][x-1][1])%mod;
				}
				else
				{
					dp[wsk][x][0] = (dp[wsk-1][x][0] + dp[wsk-1][x][1] + dp[wsk-1][x-1][0])%mod;
					if(j + k <= n)
					dp[wsk][x][1] = (dp[wsk-1][x-1][0] + dp[wsk-1][x-1][1])%mod;
				}
				//cout << dp[wsk][x][0] << " " << dp[wsk][x][1] << endl;
			}
		}
	}
}


ll ans (int n)
{
	ll odp = 0;
	for(int i = 0; i<=n; ++i)
	{
		if (i%2 == 0)
			odp = (odp + (((dp[n][i][0] + dp[n][i][1])%mod)*silnia[n-i])%mod)%mod;
		else
			odp = (mod + odp - (((dp[n][i][0] + dp[n][i][1])%mod)*silnia[n-i])%mod)%mod;
	}
	return odp;
}

int main()
{
	int n, k;
	cin >> n >> k;
	silnia[0]=1;
	calculate_dp (n, k);
	cout << ans(n);
	return 0;
}