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

cnt = 0

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

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

        n = N-r*R-g*G

        if n>=0 and n%B==0:

            cnt += 1

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

cnt = 0

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

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

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

            cnt += 1

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

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

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