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

ans=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:

            ans+=1

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

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

ans=0

for b in range(1+N//B):

      for g in range(1+(N-b*B)//G):

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

                  ans+=1

print(ans)
r, g, b, n = list(map(int, input().split()))
ans = 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:
            ans += 1
print(ans)

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

-r, g, b, n = list(map(int, input().split())) +R, G, B, N = list(map(int, input().split())) +R, G, B = sorted([R, G, B]) -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 b in range(1 + N // B): +    for g in range(1 + (N - b * B) // G): +        if (N - b * B - g * G) % R == 0: