atcoder#AGC045C. [AGC045C] Range Set

[AGC045C] Range Set

Score : 800800 points

Problem Statement

Snuke has a string xx of length NN. Initially, every character in xx is 0.

Snuke can do the following two operations any number of times in any order:

  • Choose AA consecutive characters in xx and replace each of them with 0.
  • Choose BB consecutive characters in xx and replace each of them with 1.

Find the number of different strings that xx can be after Snuke finishes doing operations. This count can be enormous, so compute it modulo (109+7)(10^9+7).

Constraints

  • 1N50001 \leq N \leq 5000
  • 1A,BN1 \leq A,B \leq N
  • All values in input are integers.

Input

Input is given from Standard Input in the following format:

NN AA BB

Output

Print the number of different strings that xx can be after Snuke finishes doing operations, modulo (109+7)(10^9+7).

4 2 3
11

For example, xx can be 0011 or 1111 in the end, but cannot be 0110.

10 7 2
533
1000 100 10
828178524