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

ans=0

r,g,b=max(r,g,b),r+g+b-max(r,g,b)-min(r,g,b),min(r,g,b)

for i in range(n//r+1):

  for j in range(n//g+1):

    if (n-i*r-j*g)%b or (n-i*r-j*g)<0:

      continue

    ans+=1

print(ans)

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



ans=0

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

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

        if (R*r+B*b-n)<=0 and (R*r+B*b-n)%g==0:

            ans+=1

            

print(ans)
r, g, b, n = list(map(int, input().split()))
ans = 0
r, g, b = max(r, g, b), r + g + b - max(r, g, b) - min(r, g, b), min(r, g, b)
for i in range(n // r + 1):
    for j in range(n // g + 1):
        if (n - i * r - j * g) % b or (n - i * r - j * g) < 0:
            continue
        ans += 1
print(ans)

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

-r, g, b = max(r, g, b), r + g + b - max(r, g, b) - min(r, g, b), min(r, g, b) -for i in range(n // r + 1): -    for j in range(n // g + 1): -        if (n - i * r - j * g) % b or (n - i * r - j * g) < 0: -            continue -        ans += 1 +for R in range(n // r + 1): +    for B in range((n) // b + 1): +        if (R * r + B * b - n) <= 0 and (R * r + B * b - n) % g == 0: +            ans += 1