2598. Revenge of the Round Table

单点时限: 5.0 sec

内存限制: 256 MB

Two contries A and B have decided to make a meeting to get acquainted with each other. n ambassadors from A and B will attend the meeting in total.

A round table is prepared for in the meeting. The ambassadors are getting seated at the round table, butthey have agreed that more than k ambassadors from the same country does not sit down at the round table in a row for deeper exchange.

Your task is to write a program that reports the number of possible arrangements when rotations are not counted. Your program should report the number modulo M = 1000003.

Let us provide an example. Suppose n = 4 and k = 2. When rotations are counted as different arrangements, the following six arrangements are possible.

AABB

ABBA

BBAA

BAAB

ABAB

BABA

However, when rotations are regarded as same, the following two arrangements are possible.

AABB

ABAB

Therefore the program should report 2.

输入格式

The input consists of two integers n (1 ≤ n ≤ 1000) and k (1 ≤ k ≤ 1000) in one line.

It does not always hold k < n. This means the program should consider cases in which the ambassadors from only one country attend the meeting.

输出格式

Print the number of possible arrangements modulo M = 1000003 in one line.

样例

Input
3 1
/*
3 2
3 3
4 2
10 5
1000 500
*/
Output
0
/*
2
4
2
90
570682
*/

2 人解决,4 人已尝试。

3 份提交通过,共有 8 份提交。

9.0 EMB 奖励。

创建: 14 年,6 月前.

修改: 7 年,3 月前.

最后提交: 4 年前.

来源: Japan

题目标签