a,b,c,n=list(map(int,input().split()))

ans=0

for x in range((n+a)//a):

  for y in range((n+b-a*x)//b):

    z=n-a*x-b*y

    if z>=0 and z%c==0:

      ans+=1

print(ans)

a,b,c,n=list(map(int,input().split()))

ans=0

for x in range(0,n+1,a):

  for y in range(x,n+1,b):

    if (n-y)%c==0:

      ans+=1

print(ans)

a, b, c, n = list(map(int, input().split()))
ans = 0
for x in range((n + a) // a):
    for y in range((n + b - a * x) // b):
        z = n - a * x - b * y
        if z >= 0 and z % c == 0:
            ans += 1
print(ans)

a, b, c, n = list(map(int, input().split()))
ans = 0
for x in range(0, n + 1, a):
    for y in range(x, n + 1, b):
        if (n - y) % c == 0:
            ans += 1
print(ans)

-for x in range((n + a) // a): -    for y in range((n + b - a * x) // b): -        z = n - a * x - b * y -        if z >= 0 and z % c == 0: +for x in range(0, n + 1, a): +    for y in range(x, n + 1, b): +        if (n - y) % c == 0: