#include<cstdio>
#include<iostream>
#include<cstring>
#include<cstdlib>
#include<cmath>
#include<algorithm>
#include<vector>
#include<queue>
#include<string>
#include<stack>
using namespace std;
const int maxn = 110;

long long c(int n ,int m)
{
	long long ans = 1;
	for (long long i = 1; i <= m; i++)
	{
		ans = ans * (n - m + i) / i;
	}
	return ans;
}

int main()
{
	int N, A, B;
	long long K,ans=0;
	scanf("%d%d%d%lld", &N, &A, &B, &K);
	if (K == 0)
	{
		printf("0");
		return 0;
	}
	for (int i=0; i<=N; i++)
	{
		if (i*A > K) continue;
		if ((N-i*A)%B != 0)continue;
		int y = (N - i * A)/B;
		if (y > N)continue;
		ans = ans + c(N, i)*c(N, y);
	}
	printf("%lld", ans);

	system("pause");
	return 0;
}