CodeEff/ECCO huggingface dataset:
# Original solution
import sys
from collections import deque
sys.setrecursionlimit(10*5)

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

print(ans)

# Optimized solution
ans=0
r,g,b,n=list(map(int,input().split()))
for i in range(n//r+2):
    for j in range(n//g+2):
        k=n-i*r-j*g
        if k>=0 and k%b==0:
            ans+=1

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

print(ans)

# Optimized solution
# coding: utf-8
#-------------------------------------------------------------------
import sys
def p(*a):
  s=" ".join(map(str,a))
  #print(s)
  sys.stderr.write(s+"\n")
#-------------------------------------------------------------------

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

if R<G: R,G=G,R
if G<B: G,B=B,G
if R<G: R,G=G,R

r=g=b=0
ans=0

#p(N//R+2)
#p(N//G+2)
#X=[]
#p(r,g,b)

for r in range(N//R+2):
	if (R*r)>N: break

	for g in range(N//G+2):
		if (R*r)+(G*g)>N:
			break
			X.append("break")
		
		b = (N-(R*r)-(G*g))//B
		n = (R*r)+(G*g)+(B*b)
		if n==N:
			ans+=1
#			X.append([r,g,b])
#		p(r,g,b,n,N,ans)

print(ans)
#p(X)
# Original solution
R, G, B, N = list(map(int, input().split()))

answer = 0
for r in range(N//R+1):
  for g in range(N//G+1):
    if r*R + g*G > N or (N-r*R-g*G)%B != 0:
      continue
    else:
      answer += 1
print(answer)


# Optimized solution
R, G, B, N = list(map(int, input().split()))

answer = 0
for r in range(N//R+1):
  for g in range(N//G+1):
    if r*R + g*G > N:
      break
    elif (N-r*R-g*G)%B != 0:
      continue
    else:
      answer += 1
print(answer)
# Original solution
#!/usr/bin/env python3
import sys


def solve(R: int, G: int, B: int, N: int):
    cnt= 0
    for r in range(0, N+1, R):
        for g in range(0, N + 1 - r, G):
            if N - r - g < 0:
                break
            b = (N - r - g) / B
            if b % 1 == 0 and b >= 0:
                cnt += 1
            else:
                continue
    print(cnt)
    return


# Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    R = int(next(tokens))  # type: int
    G = int(next(tokens))  # type: int
    B = int(next(tokens))  # type: int
    N = int(next(tokens))  # type: int
    solve(R, G, B, N)

if __name__ == '__main__':
    main()


# Optimized solution
#!/usr/bin/env python3
import sys


def solve(R: int, G: int, B: int, N: int):
    cnt= 0
    for r in range(0, N + 1, R):
        upper = N + 1 - r
        for g in range(0, upper, G):
            temp = upper-1-g
            if temp < 0:
                break
            b = temp / B
            if b % 1 == 0 and b >= 0:
                cnt += 1
            else:
                continue
    print(cnt)
    return


# Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    R = int(next(tokens))  # type: int
    G = int(next(tokens))  # type: int
    B = int(next(tokens))  # type: int
    N = int(next(tokens))  # type: int
    solve(R, G, B, N)

if __name__ == '__main__':
    main()
# Original solution
'''
B - RGB Boxes
'''

r_weight, g_weight, b_weight, N = list(map(int, input().split()))

ans = 0
for r in range(N+1):
    if r*r_weight > N:
        break
    for g in range(N-r*r_weight+1):
        if r*r_weight + g*g_weight > N:
            break
        b = (N - r*r_weight - g*g_weight) // b_weight
        if r*r_weight + g*g_weight + b*b_weight == N and b >= 0:
            ans += 1

print(ans)


# Optimized solution
'''
B - RGB Boxes
'''

r_weight, g_weight, b_weight, N = list(map(int, input().split()))

ans = 0
for r in range(N+1):
    for g in range(N-r*r_weight+1):
        rem = N - r*r_weight - g*g_weight
        if rem % b_weight == 0 and rem >= 0:
            ans += 1

print(ans)
# Original solution
R,G,B,N = list(map(int, input().split()))
count = 0
for r in range(N+1):
    for g in range(N+1-r):
        if (N-R*r-G*g) % B ==0 and -1 < N-R*r-G*g :
            count += 1
print(count)

# Optimized solution
R,G,B,N = list(map(int, input().split()))
count = 0
for r in range(N//R +1):
    for g in range((N-r*R)//G + 1):
        if (N-R*r-G*g) % B ==0:
            count += 1

print(count)
# Original solution
R,G,B,N = list(map(int, input().split()))

ans = int(0)
x = int(N//R)

for i in range(x+1):
    t = N-i*R
    y = int(t//G)
    for j in range(y+1) :
        s = int(N-R*i-G*j)
        if s%B==0 : ans +=1

print(ans)

# Optimized solution
R,G,B,N = list(map(int, input().split()))

ans = int(0)
x = int(N//R)

for i in range(x+1):
    t = N-i*R
    y = int(t//G)
    for j in range(y+1) :
        s = int(t-G*j)
        if s%B==0 : ans +=1

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

ans = 0
for r in range(N//R+1):
  for g in range(N//G+1):
    if  r*R+g*G <= N and (N-r*R-g*G) % B == 0:
      ans += 1
print(ans)

# Optimized solution
R, G, B, N = list(map(int, input().split()))
 
ans = 0
for r in range(N//R+1):
  for g in range(N//G+1):
    tmp = r*R+g*G
    if  tmp <= N and (N-tmp) % B == 0:
      ans += 1
print(ans)
# Original solution
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):
        b=N-(R*i+G*j)
        if B==0 or (b>=0 and b%B==0): 
            ans+=1

print(ans)

# Optimized solution
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):
        b=N-(R*i+G*j)
        if b==0 or  b%B==0: 
            ans+=1

print(ans)
# Original solution
a,b,c,d=list(map(int,input().split()))
e=[a,b,c]
w,r,t=e[0],e[1],e[2]
u=0
for i in range(d//a+1):
    y=d-(a*i)
    for o in range(y+1):
        x=y-(b*o)
        if y==0 or x==0 or x%c==0 and x>=0:
            u+=1
print(u)

# Optimized solution
a,b,c,d=list(map(int,input().split()))
e=[a,b,c]
w,r,t=e[0],e[1],e[2]
u=0
for i in range(d//a+1):
    y=d-(a*i)
    for o in range(y+1):
        x=y-(b*o)
        if x%c==0 and x>=0:
            u+=1
print(u)
# Original solution
R,G,B,N = list(map(int,input().split()))
cnt = 0
for r in range(N//R+1):
    for g in range(N//G+1):
        n = N-r*R-g*G
        if n>=0 and n%B==0:
            cnt += 1
print(cnt)

# Optimized solution
R,G,B,N = list(map(int,input().split()))
cnt = 0
for r in range(N//R+1):
    for g in range((N-r*R)//G+1):
        if (N-r*R-g*G)%B==0:
            cnt += 1
print(cnt)
# Original solution
R,G,B,N= list(map(int,input().split()))

cnt = 0

a = 3000//R
b = 3000//G
c = 3000//B
for i in range(0,a+1):
    for j in range(0,b + 1):
        if(R*i+G*j)<=N and (N-R*i - G*j )%B==0:

            cnt += 1
            # print(cnt)
        # if(R*i + G*j) < == N:
        #     cnt += (N-R*i + G*j )//B
        # # for k in range(0,c + 1):
        #     # if (R*i + G*j + B * k) == N:
        #     #     cnt += 1


print(cnt)


# Optimized solution
R,G,B,N= list(map(int,input().split()))

cnt = 0

a = 3000//R


for i in range(0,a+1):
    b = (3000-R*i)//G
    for j in range(0,b + 1):
        if(R*i+G*j)<=N and (N-R*i - G*j )%B==0:

            cnt += 1
            # print(cnt)
        # if(R*i + G*j) < == N:
        #     cnt += (N-R*i + G*j )//B
        # # for k in range(0,c + 1):
        #     # if (R*i + G*j + B * k) == N:
        #     #     cnt += 1


print(cnt)
# Original solution
r, g, b, n = list(map(int, input().split()))
 
count = 0
for i_r in range(0,int(n/r)+1):
    if (n - r*i_r)<0:continue
    for i_g in range(0,int(n/g)+1):
        if (n - r*i_r - g*i_g)<0:continue
        if 0==((n - r*i_r - g*i_g)%b):
 
            count +=1
 
print(count)

# Optimized solution
r, g, b, n = list(map(int, input().split()))
 
count = 0
for i_r in range(0,int(n)+1):
    if (n - r*i_r)<0:continue
    for i_g in range(0,int(n)+1):
        if (n - r*i_r - g*i_g)<0:continue
        if 0==((n - r*i_r - g*i_g)%b):
 
            count +=1
 
print(count)
# Original solution
import sys
input = sys.stdin.readline
R, G, B, N = list(map(int, input().split()))
cnt = 0
for i in range(int(N/R)+1):
    r = i*R
    for j in range(int(N/G)+1):
        g = j*G
        b = N - g - r
        if b >= 0 and b % B == 0:
            cnt += 1
print(cnt)

# Optimized solution
R, G, B, N = list(map(int, input().split()))
cnt = 0
for i in range(int(N/R)+1):
    r = i*R
    for j in range(int(N/G)+1):
        g = j*G
        b = N - g - r
        if b >= 0 and b % B == 0:
            cnt += 1
print(cnt)
# Original solution
# from pprint import pprint
# import math
# import collections

# n = int(input())
R, G, B, N = list(map(int, input().split(' ')))
# a = list(map(int, input().split(' ')))

max_r, max_g, max_b = N // R, N // G, N // B
ans = []

r, g, b = 0, 0, 0
cnt = 0
for r in range(3000):
    if R * r > N:
        break

    max_g = (N - R * r) // G

    for g in range(max_g + 1):
        if R * r + G * g > N:
            break
        x = (N - (R * r + G * g))
        if x % B == 0 and x >= 0:
            b = x // B
            a = (r, g, b)
            cnt += 1
            # ans.append(a)

# print(len(ans))
print(cnt)


# Optimized solution
# from pprint import pprint
# import math
# import collections

# n = int(input())
R, G, B, N = list(map(int, input().split(' ')))
# a = list(map(int, input().split(' ')))

# max_r, max_g, max_b = N // R, N // G, N // B
ans = []

r, g, b = 0, 0, 0
cnt = 0

max_r = N // R
for r in range(max_r + 1):
    if R * r > N:
        break

    max_g = (N - R * r) // G

    for g in range(max_g + 1):
        if R * r + G * g > N:
            break
        x = (N - (R * r + G * g))
        if x % B == 0 and x >= 0:
            # b = x // B
            # a = (r, g, b)
            cnt += 1
            # ans.append(a)

# print(len(ans))
print(cnt)
# Original solution
R, G, B, N = list(map(int, input().split()))

RGB = sorted([R, G, B], reverse=True)
max1 = N // RGB[0] 

count = 0
for r in range(max1+1):
    max2 = min([N-r, (N-r*RGB[0])//RGB[1]])
    for g in range(max2+1):
        Bb = N - (r*RGB[0] + g*RGB[1])
        if Bb >= 0 and Bb % RGB[2] == 0:
            count += 1
print(count)

# Optimized solution
R, G, B, N = list(map(int, input().split()))

RGB = sorted([R, G, B], reverse=True)
max1 = N // RGB[0] 

count = 0
for r in range(max1+1):
    max2 = min([N-r, (N-r*RGB[0])//RGB[1]])
    for g in range(max2+1):
        if (N - (r*RGB[0] + g*RGB[1])) % RGB[2] == 0:
            count += 1
print(count)
# Original solution
from sys import exit

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

count = 0

for r in range(N // R + 1):
	for g in range((N - r * R) // G + 1):
		if N - r * R - g * G < 0:
			break
		if (N - r * R - g * G) % B == 0:
			count += 1

print(count)


# Optimized solution
from sys import exit

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

count = 0

for r in range(N // R + 1):
	for g in range((N - r * R) // G + 1):
		if (N - r * R - g * G) % B == 0:
			count += 1

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

ans = 0
for i in range(1+n//r):
  for j in range(1+n//g):
    div = (n - g*j - r*i)//b
    mod = (n - g*j - r*i)%b
    if div >= 0 and mod == 0:
      ans += 1
        
print(ans)

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

ans = 0
for i in range(1+n//r):
  tmp = n - r*i
  for j in range(1+tmp//g):
    mod = (n - g*j - r*i)%b
    if mod == 0:
      ans += 1
        
print(ans)
# Original solution
R,G,B,n=list(map(int, input().split()))
ans=0

for r in range(n+1):
    for g in range(n+1-r):
        b = n-r-g
        if b%B==0 and r%R==0 and g%G==0:
            ans+=1

print(ans)


# Optimized solution
R,G,B,n=list(map(int, input().split()))
ans=0

for r in range(n+1):
    if r%R==0:
        for g in range(n+1-r):
            b = n-r-g
            if b%B==0 and r%R==0 and g%G==0:
                ans+=1

print(ans)
# Original solution
import collections
r, g, b, n = list(map(int, input().split()))

sum_rg = collections.Counter()

for i in range(n + 1):
    if n < r*i:
        break
    for j in range(n + 1):
        if n < r*i + g*j:
            break
        sum_rg[r*i + g*j] += 1

ans = 0
for k in range(n + 1):
    if n < b*k:
        break
    ans += sum_rg[n - b*k]

#print(sum_rg)
print(ans)

# Optimized solution
import collections
r, g, b, n = list(map(int, input().split()))

#sum_rg = collections.Counter()  # TLE
sum_rg = collections.defaultdict(int)

for i in range(n + 1):
    if n < r*i:
        break
    for j in range(n + 1):
        if n < r*i + g*j:
            break
        sum_rg[r*i + g*j] += 1

ans = 0
for k in range(n + 1):
    if n < b*k:
        break
    ans += sum_rg[n - b*k]

#print(sum_rg)
print(ans)
# Original solution
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

r, g, b, n = list(map(int, read().split()))
cnt = 0
for i in range(n + 1):
    for j in range(n + 1):
        check = n - (r * i + g * j)
        if check >= 0:
            if check % b == 0:
                cnt += 1
        else:
            break
print(cnt)


# Optimized solution
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

r, g, b, n = list(map(int, read().split()))
cnt = 0
for i in range(n // r + 1):
    for j in range(n // g + 1):
        check = n - (r * i + g * j)
        if check >= 0:
            if check % b == 0:
                cnt += 1
        else:
            break
print(cnt)
# Original solution
r, g, b, n = list(map(int, input().split()))

cnt = 0
for i in range(n//r + 1):
    for j in range(n//g + 1):
        nb = (n - (i*r+j*g))/b

        if (nb >= 0) and (nb % 1 == 0):
            cnt += 1

print(cnt)

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

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

        if (nb >= 0):
            if (nb % b == 0):
                cnt += 1
        else:
            break

print(cnt)
# Original solution
R, G, B, N = list(map(int, input().split()))

ok = 0
for r in range(N // R + 1):
    for g in range(N // G + 1):
        last_num = N - (r * R) - (g * G)
        if last_num >= 0 and last_num % B == 0:
            ok += 1

print(ok)

# Optimized solution
R, G, B, N = list(map(int, input().split()))

ok = 0
for r in range(N // R + 1):
    for g in range((N - r * R) // G + 1):
        last_num = N - (r * R) - (g * G)
        if last_num >= 0 and last_num % B == 0:
            ok += 1

print(ok)
# Original solution
R,G,B,N= list(map(int,input().split()))

cnt = 0
for i in range(N+1):
    for j in range(N+1):
        k = N - R*i- G*j
        if k<0 or k % B != 0 : continue
        k /= B
        cnt += 1
            
print(cnt)

# Optimized solution
R,G,B,N= list(map(int,input().split()))

cnt = 0
for i in range(N+1):
    for j in range(N+1):
        k = N - R*i- G*j
        if k<0 or k % B != 0 : continue
        cnt += 1
            
print(cnt)
# Original solution
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)

# Optimized solution
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)
# Original solution
r, g, b, n = list(map(int, input().split()))

cnt = 0
for i in range(3001):
    for j in range(3001):
        if (n-i*r-j*g) % b == 0 and (n-i*r-j*g) // b >= 0:
            cnt += 1

print(cnt)

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

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

print(cnt)
# Original solution
r0,g0,b0,n=list(map(int,input().split()))
ans=0
l=[r0,g0,b0]
l.sort(reverse=True)
r=l[0]
g=l[1]
b=l[2]
x=0
while x*r<=n:
    y=0
    while y*g<=n-x*r:
        if (n-x*r-y*g) % b == 0:
            ans+=1
        y+=1
    x+=1
print(ans)

# Optimized solution
r0,g0,b0,n=list(map(int,input().split()))
ans=0
l=[r0,g0,b0]
l.sort(reverse=True)
r=l[0]
g=l[1]
b=l[2]
x=0
while x*r<=n:
    y=0
    if g==1:
        ans+=1+n-x*r
        x+=1
        continue
    if b==1:
        ans+=1+(n-x*r)//g
        x+=1
        continue
    while y*g<=n-x*r:
        if (n-x*r-y*g) % b == 0:
            ans+=1
        y+=1
    x+=1
print(ans)
# Original solution
r,g,b,n=list(map(int,input().split()))
ans=0
x=0
while x*r<=n:
    y=0
    while y*g<=n-x*r:
        aaa = (n-x*r-y*g) / b
        if aaa.is_integer():
            ans+=1
        y+=1
    x+=1
print(ans)

# Optimized solution
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)
# Original solution
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)

# Optimized solution
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)
# Original solution
R,G,B,N = list(map(int, input().split()))
count = 0
for r in range(N//R+1):
    if R*r> N:
         break
    for g in range(N//G+1):
        if R*r + G*g > N:
            break
        if (N - (R*r + G*g)) %B == 0 :
            count += 1
print(count)

# Optimized solution
R,G,B,N = list(map(int, input().split()))
count = 0

for r in range(N//R+1):
    if R*r> N:
         break
    for g in range(N//G+1):
        aa = N-R*r- G*g
        if aa < 0:
            break
        if aa %B == 0 :
            count += 1
print(count)
# Original solution
R, G, B, N = list(map(int, input().split()))
ans = 0
for r in range((N//R)+1):
    for g in range((N//G)+1):
        v = R * r + G * g
        if v > N:
            continue
        if (N - v) % B != 0:
            continue
        ans +=1 
print(ans)


# Optimized solution
R, G, B, N = list(map(int, input().split()))
ans = 0
for r in range((N//R)+1):
    for g in range((N//G)+1):
        v = R * r + G * g
        if v > N:
            break
        if (N - v) % B == 0:
            ans +=1 
        
print(ans)
# Original solution
R,G,B,N=list(map(int, input().split()))
cnt = 0
for r in range(N//R+1):
    for g in range(N//G+1):
        tmp = (N-(r*R+g*G))
        if tmp>=0:
            if tmp%B==0:
                cnt += 1
print(cnt)

# Optimized solution
R,G,B,N=list(map(int, input().split()))
arr = [R,G,B]
arr = sorted(arr, reverse=True)
R,G,B = arr

cnt = 0
for r in range(N//R+1):
    for g in range((N-r*R)//G+1):
        tmp = (N-(r*R+g*G))
        if tmp>=0:
            if tmp%B==0:
                cnt += 1
print(cnt)
# Original solution
R,G,B,N = list(map(int,input().split()))
rmax = N // R
gmax = N // G
bmax = N // B
ans = 0
for r in range(rmax+1):
    for g in range(gmax+1):
        if (N - (R*r + G*g)) % B == 0:
            if 0 <= (N - (R*r + G*g) )// B <= bmax: 
                ans += 1
print(ans)

# Optimized solution
R,G,B,N = list(map(int,input().split()))
rmax = N // R
gmax = N // G
bmax = N // B
ans = 0
for r in range(rmax+1):
    for g in range(gmax+1):
        if (N - (R*r + G*g)) % B == 0 and 0 <= (N - (R*r + G*g) )// B <= bmax: 
            ans += 1
print(ans)
# Original solution
R,G,B,N = list(map(int,input().split()))

li = [R,G,B]
li.sort(reverse=True)
R = li[0]
G = li[1]
B = li[2]
#print(R,G,B)

ans = 0
for b in range(N//B+1):
    for g in range((N-B*b)//G+1):
        if N-B*b-G*g >= 0 and (N-B*b-G*g)%R == 0:
            ans += 1
print(ans)


# Optimized solution
R,G,B,N = list(map(int,input().split()))

li = [R,G,B]
li.sort()
R = li[0]
G = li[1]
B = li[2]
#print(R,G,B)

ans = 0
for b in range(N//B+1):
    for g in range((N-B*b)//G+1):
        if N-B*b-G*g >= 0 and (N-B*b-G*g)%R == 0:
            ans += 1
print(ans)
# Original solution
R,G,B,N = list(map(int,input().split()))

ans = 0
for b in range(N+1):
    for g in range(N+1):
        if N-B*b-G*g >= 0 and (N-B*b-G*g)%R == 0:
            ans += 1
print(ans)



# Optimized solution
R,G,B,N = list(map(int,input().split()))

ans = 0
for b in range(N+1):
    for g in range(N+1):
        if N-B*b-G*g < 0:
            break
        if (N-B*b-G*g)%R == 0:
            ans += 1
print(ans)
# Original solution
R,G,B,N = list(map(int,input().split()))

ans = 0
for b in range(N+1):
    for g in range(N+1):
        if N-B*b-G*g < 0:
            break
        if (N-B*b-G*g)%R == 0:
            ans += 1
print(ans)


# Optimized solution
R,G,B,N = list(map(int,input().split()))

ans = 0
for b in range(N//B+1):
    for g in range((N-B*b)//G+1):
        Rr = N-B*b-G*g
        if Rr >= 0 and Rr%R == 0:
            ans += 1
print(ans)
# Original solution
r, g, b, n = list(map(int, input().split()))
a1, a2, a3 = sorted([r, g, b])

r = 0
I = n//a3+1
J = n//a2+1
for i in range(I):
    for j in range(J):
        t = n-i*a3-j*a2
        if t>=0 and t%a1==0:
            r += 1
print(r)

# Optimized solution
r, g, b, n = list(map(int, input().split()))
a1, a2, a3 = sorted([r, g, b])

r = 0
I = n//a3+1
for i in range(I):
    for j in range((n-i)//a2+1):
        t = n-i*a3-j*a2
        if t>=0 and t%a1==0:
            r += 1
print(r)
# Original solution
# coding: utf-8 
r, g, b, n = list(map(int, input().split()))
cnt = 0
for i in range(n//r+1):
    for j in range((n-i*r)//g+1):
        if n-i*r-j*g>=0 and (n-i*r-j*g)%b==0:
            cnt+=1
print(cnt)


# Optimized solution
# coding: utf-8 
r, g, b, n = list(map(int, input().split()))
cnt = 0
for i in range(n//r+1):
    for j in range((n-i*r)//g+1):
        if (n-i*r-j*g)%b==0:
            cnt+=1
print(cnt)
# Original solution
import re
import sys
import math
import itertools
import bisect
from copy import copy
from collections import deque,Counter
from decimal import Decimal
import functools
def v(): return eval(input())
def k(): return int(eval(input()))
def S(): return input().split()
def I(): return list(map(int,input().split()))
def X(): return list(eval(input()))
def L(): return list(input().split())
def l(): return list(map(int,input().split()))
def lcm(a,b): return a*b//math.gcd(a,b)
sys.setrecursionlimit(10 ** 9)
mod = 10**9+7
cnt = 0
ans = 0
inf = float("inf")

r,g,b,n = I()
a = []
a.append(r)
a.append(g)
a.append(b)
a.sort()
a[0],a[1],a[2] = r,g,b

mx_b = n//b
amari = n%b
for i in range(n//r + 1):
    for j in range(n//g + 1):
        if (r*i+g*j) % b == amari and (r*i+g*j)//b <= mx_b:
            cnt += 1

print(cnt)

# Optimized solution
import re
import sys
import math
import itertools
import bisect
from copy import copy
from collections import deque,Counter
from decimal import Decimal
import functools
def v(): return eval(input())
def k(): return int(eval(input()))
def S(): return input().split()
def I(): return list(map(int,input().split()))
def X(): return list(eval(input()))
def L(): return list(input().split())
def l(): return list(map(int,input().split()))
def lcm(a,b): return a*b//math.gcd(a,b)
sys.setrecursionlimit(10 ** 9)
mod = 10**9+7
cnt = 0
ans = 0
inf = float("inf")

r,g,b,n = I()
a = []
a.append(r)
a.append(g)
a.append(b)
a.sort()
a[0],a[1],a[2] = r,g,b

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

print(cnt)