#include<iostream>
#include<algorithm>
#include<cstring>
using namespace std;
int n, s, a, b;
const int N = 1010;
const int MOD=100000007;
int f[N][N];
int get_mod(int a, int b) {
return (a % b + b) % b;
}
int main(){
cin >> n >> s >> a >> b;
f[0][0] = 1;
for (int i = 1; i < n; i++)
for (int j = 0; j < n; j++)
f[i][j] = (f[i-1][get_mod(j-a*i,n)]+ f[i - 1][get_mod(j + b * i, n)]) % MOD;
cout << f[n - 1][get_mod(s,n)] << endl;
}