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



ans = 0

for i in range(n+1):

    for j in range(n+1):

        s = n - r*i - g*j

        if s < 0:

            continue

        else:

            if s%b == 0:

                ans += 1

print(ans)

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

ans = 0

for r in range(N+1):

    for g in range(N+1):

        res = N-R*r-G*g

        if res < 0:

            continue

        else:

            if res%B == 0:

                ans += 1

print(ans)

r, g, b, n = list(map(int, input().split()))
ans = 0
for i in range(n + 1):
    for j in range(n + 1):
        s = n - r * i - g * j
        if s < 0:
            continue
        else:
            if s % b == 0:
                ans += 1
print(ans)

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

-r, g, b, n = list(map(int, input().split())) +R, G, B, N = list(map(int, input().split())) -for i in range(n + 1): -    for j in range(n + 1): -        s = n - r * i - g * j -        if s < 0: +for r in range(N + 1): +    for g in range(N + 1): +        res = N - R * r - G * g +        if res < 0: -            if s % b == 0: +            if res % B == 0: