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

ans = 0

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

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

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

        if b == int(b) and b >= 0:

            ans += 1

print(ans)

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

ans = 0

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

    for g in range((N - R*r)//G + 1):

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

        if b == int(b):

            ans += 1

print(ans)

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

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

-    for g in range(N // G + 1): -        b = (N - R * r - G * g) / B -        if b == int(b) and b >= 0: +    for g in range((N - R * r) // G + 1): +        b = (N - (R * r + G * g)) / B +        if b == int(b):