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

ans=0

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

    for j in range(((n-r*i)//g+1)):

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

            ans+=1

print(ans)

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

ans=0

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

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

        if (n-(i*r+j*g))%b==0:

            if 0<=n-i*r-j*g:

                ans+=1

print(ans)

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

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

-for i in range((n // r) + 1): -    for j in range(((n - r * i) // g + 1)): -        if (n - i * r - j * g) % b == 0: -            ans += 1 +for i in range(n // r + 1): +    for j in range(n // g + 1): +        if (n - (i * r + j * g)) % b == 0: +            if 0 <= n - i * r - j * g: +                ans += 1