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

 

 

cnt = 0

ball = 0

a = sorted([R,G,B])

for r in range(N//a[0]+1):

    ball = r*a[0]

    for b in range((N-ball)//a[1]+1):

        if N-ball >= 0 and (N-ball-b*a[1])%a[2] == 0:

            cnt += 1

 

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

cnt = 0

for i in range(n+1):

    for j in range(n+1):

        rest = n - i*r - j*g

        if rest >=0 and rest%b==0:

            cnt += 1

print(cnt)
R, B, G, N = list(map(int, input().split()))
cnt = 0
ball = 0
a = sorted([R, G, B])
for r in range(N // a[0] + 1):
    ball = r * a[0]
    for b in range((N - ball) // a[1] + 1):
        if N - ball >= 0 and (N - ball - b * a[1]) % a[2] == 0:
            cnt += 1
print(cnt)

r, g, b, n = list(map(int, input().split()))
cnt = 0
for i in range(n + 1):
    for j in range(n + 1):
        rest = n - i * r - j * g
        if rest >= 0 and rest % b == 0:
            cnt += 1
print(cnt)

-R, B, G, N = list(map(int, input().split())) +r, g, b, n = list(map(int, input().split())) -ball = 0 -a = sorted([R, G, B]) -for r in range(N // a[0] + 1): -    ball = r * a[0] -    for b in range((N - ball) // a[1] + 1): -        if N - ball >= 0 and (N - ball - b * a[1]) % a[2] == 0: +for i in range(n + 1): +    for j in range(n + 1): +        rest = n - i * r - j * g +        if rest >= 0 and rest % b == 0: