2023031707 - 波动数列_1

通过次数

0

提交次数

0

Time Limit : 1 秒
Memory Limit : 128 MB

历届试题&nbsp 波动数列&nbsp  
时间限制:1.0s&nbsp  &nbsp 内存限制:256.0MB
 &nbsp  &nbsp
问题描述
  观察这个数列:
  1&nbsp 3&nbsp 0&nbsp 2&nbsp -1&nbsp 1&nbsp -2&nbsp ...

  这个数列中后一项总是比前一项增加2或者减少3。

  栋栋对这种数列很好奇,他想知道长度为&nbsp n&nbsp 和为&nbsp s&nbsp 而且后一项总是比前一项增加a或者减少b的整数数列可能有多少种呢?
输入格式
  输入的第一行包含四个整数&nbsp n&nbsp s&nbsp a&nbsp b,含义如前面说述。
输出格式
  输出一行,包含一个整数,表示满足条件的方案数。由于这个数很大,请输出方案数除以100000007的余数。
样例输入
4&nbsp 10&nbsp 2&nbsp 3
样例输出
2
样例说明
  这两个数列分别是2&nbsp 4&nbsp 1&nbsp 3和7&nbsp 4&nbsp 1&nbsp -2。
数据规模和约定
  对于10%的数据,1< =n< =5,0< =s< =5,1< =a,b< =5;
  对于30%的数据,1< =n< =30,0< =s< =30,1< =a,b< =30;
  对于50%的数据,1< =n< =50,0< =s< =50,1< =a,b< =50;
  对于70%的数据,1< =n< =100,0< =s< =500,1< =a,&nbsp b< =50;
  对于100%的数据,1< =n< =1000,-1,000,000,000< =s< =1,000,000,000,1< =a,&nbsp b< =1,000,000。

Input

Output

Examples

Input


                            

Output


                            

Hint

请关注微信公众号onlinejudge

Source

历届试题