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

ans = 0

for r in range(n // R + 1):

    for g in range((n - r) // G + 1):

        if (n - r * R - g * G) % B == 0:

            b = (n - r * R - g * G) / B

            if b >= 0:

                ans += 1

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

a = [0] * (n + 1)

a[0] = 1

for i in [r, g, b]:

    for j in range(n + 1 - i):

        a[i + j] += a[j]

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

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

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