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

cnt = 0

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

    for y in range((N-x*R)//G+1):

        if (N-x*R-y*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-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 x in range(N // R + 1):
    for y in range((N - x * R) // G + 1):
        if (N - x * R - y * 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 - r * R) // G + 1):
        if (N - r * R - g * G) % B == 0:
            cnt += 1
print(cnt)

-for x in range(N // R + 1): -    for y in range((N - x * R) // G + 1): -        if (N - x * R - y * G) % B == 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: