R, G, B, N = list(map(int, input().split()))



ans = 0



for g in range(N//G+1):

    for b in range(N//B+1):

        s = N-g*G-b*B

        if s < 0:

            break

        if s%R == 0:

            ans += 1



print(ans)
r, g, b, n = list(map(int, input().split()))



dp = [0 for i in range(n+1)]

dp[0] = 1



for i in range(r, n+1, r):

    dp[i] = 1

for i in range(g, n+1):

    dp[i] += dp[i-g]

for i in range(b, n+1):

    dp[i] += dp[i-b]



print((dp[-1]))
R, G, B, N = list(map(int, input().split()))
ans = 0
for g in range(N // G + 1):
    for b in range(N // B + 1):
        s = N - g * G - b * B
        if s < 0:
            break
        if s % R == 0:
            ans += 1
print(ans)

r, g, b, n = list(map(int, input().split()))
dp = [0 for i in range(n + 1)]
dp[0] = 1
for i in range(r, n + 1, r):
    dp[i] = 1
for i in range(g, n + 1):
    dp[i] += dp[i - g]
for i in range(b, n + 1):
    dp[i] += dp[i - b]
print((dp[-1]))

-R, G, B, N = list(map(int, input().split())) -ans = 0 -for g in range(N // G + 1): -    for b in range(N // B + 1): -        s = N - g * G - b * B -        if s < 0: -            break -        if s % R == 0: -            ans += 1 -print(ans) +r, g, b, n = list(map(int, input().split())) +dp = [0 for i in range(n + 1)] +dp[0] = 1 +for i in range(r, n + 1, r): +    dp[i] = 1 +for i in range(g, n + 1): +    dp[i] += dp[i - g] +for i in range(b, n + 1): +    dp[i] += dp[i - b] +print((dp[-1]))