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 5.4.1) (judge verdict: Wrong Answer)

#include <cstdio>
#define FOR(i,a,b) for(int i=a;i<=b;++i)
const int N=2005;
const int P=924844033;
int n,k,a[N],fac[N],f[N][N][2][2];
bool vis[N];

int main() {
	scanf("%d%d",&n,&k);
	fac[0]=1;
	FOR(i,1,n) fac[i]=1LL*fac[i-1]*i%P;
	int tot=0;
	FOR(i,1,n) if(!vis[i]) for(int j=i;j<=n;j+=k) vis[j]=1,a[++tot]=j;
	f[0][0][0][0]=1;
	a[0]=-k-1; a[n+1]=k-1;
	FOR(i,1,n) {
		f[i][0][0][0]=1;
		FOR(j,1,i) {
			f[i][j][0][0]=(f[i-1][j][1][0]+f[i-1][j][0][0]+(a[i]-a[i-1]==k)*f[i-1][j-1][0][0])%P;
            f[i][j][0][1]=(a[i+1]-a[i]==k)*(f[i-1][j-1][1][0]+f[i-1][j-1][0][0])%P;
            f[i][j][1][0]=(f[i-1][j][0][1]+f[i-1][j][1][1]+(a[i]-a[i-1]==k)*f[i-1][j-1][0][1])%P;
            f[i][j][1][1]=(a[i+1]-a[i]==k)*(f[i-1][j-1][0][1]+f[i-1][j-1][1][1])%P;
		}
	}
	long long ans=0;
	FOR(i,0,n) {
		long long sum=1LL*(f[n][i][0][0]+f[n][i][0][1]+f[n][i][1][0]+f[n][i][1][1])%P*fac[n-i]%P;
		if(i&1) (ans+=P-sum)%=P; else (ans+=sum)%=P;
	}
	printf("%lld\n",(ans%P+P)%P);
	return 0;
}