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



C = sorted([R, G, B], reverse=True)



cnt = 0

for p0 in range(N//C[0]+1):

    p0v = p0*C[0]

    for p1 in range((N-p0v)//C[1]+1):

        p1v = p1*C[1]

        if (N - p0v - p1v)%C[2] == 0:

            cnt += 1

print(cnt)

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



C = sorted([R, G, B], reverse=True)



print((sum((1 for c1 in range(0, N+1, C[0]) for c12 in range(c1, N+1, C[1]) if (N - c12) % C[2] == 0 ))))

R, G, B, N = list(map(int, input().split()))
C = sorted([R, G, B], reverse=True)
cnt = 0
for p0 in range(N // C[0] + 1):
    p0v = p0 * C[0]
    for p1 in range((N - p0v) // C[1] + 1):
        p1v = p1 * C[1]
        if (N - p0v - p1v) % C[2] == 0:
            cnt += 1
print(cnt)

R, G, B, N = list(map(int, input().split()))
C = sorted([R, G, B], reverse=True)
print(
    (
        sum(
            (
                1
                for c1 in range(0, N + 1, C[0])
                for c12 in range(c1, N + 1, C[1])
                if (N - c12) % C[2] == 0
            )
        )
    )
)

-cnt = 0 -for p0 in range(N // C[0] + 1): -    p0v = p0 * C[0] -    for p1 in range((N - p0v) // C[1] + 1): -        p1v = p1 * C[1] -        if (N - p0v - p1v) % C[2] == 0: -            cnt += 1 -print(cnt) +print( +    ( +        sum( +            ( +                1 +                for c1 in range(0, N + 1, C[0]) +                for c12 in range(c1, N + 1, C[1]) +                if (N - c12) % C[2] == 0 +            ) +        ) +    ) +)