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

r1 = 0

count = 0



while r*r1 <= n:

    g1 = 0

    while r*r1+g*g1 <= n:

        if (n-(r*r1+g*g1))%b==0:

            count += 1

        g1 += 1

    r1 += 1

print(count)

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



ans = 0



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

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

        #print(N-(r*R+g*G),r*R, g*G)

        if N-(r*R+g*G) < 0:

            break

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

            ans += 1

print(ans)
r, g, b, n = list(map(int, input().split()))
r1 = 0
count = 0
while r * r1 <= n:
    g1 = 0
    while r * r1 + g * g1 <= n:
        if (n - (r * r1 + g * g1)) % b == 0:
            count += 1
        g1 += 1
    r1 += 1
print(count)

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

-r, g, b, n = list(map(int, input().split())) -r1 = 0 -count = 0 -while r * r1 <= n: -    g1 = 0 -    while r * r1 + g * g1 <= n: -        if (n - (r * r1 + g * g1)) % b == 0: -            count += 1 -        g1 += 1 -    r1 += 1 -print(count) +R, G, B, N = list(map(int, input().split())) +ans = 0 +for r in range(1 + N // R): +    for g in range(1 + N // G): +        # print(N-(r*R+g*G),r*R, g*G) +        if N - (r * R + g * G) < 0: +            break +        if (N - (r * R + g * G)) % B == 0: +            ans += 1 +print(ans)