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

l = sorted([r,g,b])

count=0

for i in range(int(n/l[2])+1):

    for j in range(int(n/l[1])+1):

        x = l[2]*i

        y = l[1]*j

        if (n-x-y) >= 0 and (n-x-y)%l[0] == 0:

            count = count + 1

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

l = sorted([r,g,b])

count=0

for i in range(int(n/l[2])+1):

    for j in range(int(n/l[1])+1):

        x = l[2]*i

        y = l[1]*j

        if (n-x-y) < 0:

            break

        if (n-x-y) >= 0 and (n-x-y)%l[0] == 0:

            count = count + 1

print(count)
r, g, b, n = list(map(int, input().split(" ")))
l = sorted([r, g, b])
count = 0
for i in range(int(n / l[2]) + 1):
    for j in range(int(n / l[1]) + 1):
        x = l[2] * i
        y = l[1] * j
        if (n - x - y) >= 0 and (n - x - y) % l[0] == 0:
            count = count + 1
print(count)

r, g, b, n = list(map(int, input().split(" ")))
l = sorted([r, g, b])
count = 0
for i in range(int(n / l[2]) + 1):
    for j in range(int(n / l[1]) + 1):
        x = l[2] * i
        y = l[1] * j
        if (n - x - y) < 0:
            break
        if (n - x - y) >= 0 and (n - x - y) % l[0] == 0:
            count = count + 1
print(count)

+        if (n - x - y) < 0: +            break