0.SK. Nurse


Submit solution

Points: 3 (partial)
Time limit: 1.0s
Memory limit: 98M

Author:
Problem type
Allowed languages
Ada, Assembly, Awk, C, C++, C11, CLANG, CLANGX, Classical, COBOL, Coffee, CSC, D lang, DART, F95, FORTH, Fortrn, GAS32, GO, Haskell, Itercal, Java, kotlin, LEAN, LISP, LUA, MONOVB, Nasm, OCAML, Pascal, Perl, php, PIKE, prolog, Pypy, Python, Ruby 2, RUST, Scala, SCM, SED, SWIFT, TCL, TUR, V8JS, VB, ZIG

The director of a hospital want to schedule a working plan for a nurse in a given period of N consecutive days 1,..., N. Due to the policy of the hospital, each nurse cannot work all the days 1,..., N. Instead, there must be days o? in which the nurse need to take a rest. A working plan is a sequence of disjoint working periods. A working period of a nurse is de?ned to be a sequence of consecutive days on which the nurse must work and the length of the working period is the number of consecutive days of that working period. The hospital imposes two constraints:

? Each nurse can take a rest only one day between two consecutive working periods. it means that if the nurse takes a rest today, then she has to work tomorrow (1)

? The length of each working period must be greater or equal to K1 and less than or equal to K2 (2) The director of the hospital want to know how many possible working plans satisfying above constraint?

Input

The input consists of one line which contains 3 positive integers N;K1;K2(N = < 1000;K1 < K2 = < 400)

Output

The output consists of only one single integer M modulo 109 + 7 where M is the total working plans satisfying the above constraints.

Example

Input

6 2 3

Output

4

Explanation

There are 4 working plans described as follows

working plan 1 on on o? on on on

working plan 2 on on o? on on o?

working plan 3 o? on on o? on on

working plan 4 on on on o? on on


Comments


  • 1
    z3r0_l0v3  commented on Sept. 20, 2023, 8:46 a.m.

    Bài này admin chuyển về category Dynamic Program đi. Chứ bài này Backtracking thì có mà oạch