CodeEff/ECCO huggingface dataset:
# Original solution
R, G, B, N = list(map(int, input().split()))

box = sorted([R,G,B],reverse=True)

count = 0
for x in range(0,N+1,box[0]):
    for y in range(0,N+1,box[1]):
        if x + y > N:
            continue
        z = (N - x - y) / box[2]
        if z >= 0 and z.is_integer():
            count += 1
print(count)

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

box = sorted([R,G,B],reverse=True)

count = 0
for x in range(0,N+1,box[0]):
    for y in range(0,N+1 - x ,box[1]):
        z = (N - x - y) / box[2]
        if z >= 0 and z.is_integer():
            count += 1
print(count)
# Original solution
R, G, B, N = list(map(int, input().split()))

C = sorted([R, G, B], reverse=True)

cnt = 0
for p0 in range(N//C[0]+1):
    p0v = p0*C[0]
    for p1 in range((N-p0v)//C[1]+1):
        p1v = p1*C[1]
        if (N - p0v - p1v)%C[2] == 0:
            cnt += 1
print(cnt)


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

C = sorted([R, G, B], reverse=True)

print((sum((1 for c1 in range(0, N+1, C[0]) for c12 in range(c1, N+1, C[1]) if (N - c12) % C[2] == 0 ))))
# Original solution
R, G, B, N = list(map(int,input().split()))

ans = 0
for i in range(N//R+1):
    if N - R*i < 0:
        break
    for j in range(N//G+1):
        if N - R * i - G * j < 0:
            break
        if  N -R*i -G*j == 0:
            ans += 1
        elif N -R*i -G*j > 0 and (N -R*i -G*j) % 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):
        if (N -R*i -G*j) % B == 0:
            ans += 1

print(ans)
# Original solution
def main():
    R,B,G,N = list(map(int,input().split(' ')))
    cnt = 0
    for i in range(N//R+1):
        for j in range(N//G+1):
            if R*i+G*j > N:
              break
            if (N-(R*i+G*j))//B == (N-(R*i+G*j))/B and (N-(R*i+G*j))/B >=0:
                cnt +=1
    print(cnt)

if __name__ =='__main__':
    main()

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

                cnt +=1
    print(cnt)
if __name__ =='__main__':
    main()
# Original solution
from itertools import product

R, G, B, N = list(map(int, input().split()))
colors = sorted([(N // R, R), (N // G, G), (N // B, B)])
ans = 0
for i, j in product(list(range(colors[1][0]+1)), list(range(colors[2][0]+1))):
    I = colors[1][1]; J = colors[2][1]; 
    if N >= i*I + j*J and (N - (i*I + j*J)) % colors[0][1] == 0: ans += 1
print(ans)

# Optimized solution
from itertools import product

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

R, G, B, N = list(map(int, input().split()))
R_max = N // R
G_max = N // G
ans = 0
for r, g in product(list(range(R_max+1)), list(range(G_max+1))):
    b, r = divmod((N - (r*R + g*G)), B)
    if r == 0 and 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):
    N1 = N - r*R
    for g in range(N1 // G + 1):
        N2 = N1 - g*G
        if N2 % B == 0: ans += 1
print(ans)
# Original solution
R,G,B,N = list(map(int,input().split()))
c = sorted([R,G,B])
R = c[1]
G = c[2]
B = c[0]
ans = 0
for r in range(N//R+1):
    tmp = N - r*R
    for g in range(N//G+1):
        ttmp = tmp - g*G
        ans += int(ttmp%B == 0 and ttmp >= 0)
print(ans)

# Optimized solution
R,G,B,N = list(map(int,input().split()))
c = sorted([R,G,B])
R = c[1]
G = c[2]
B = c[0]
ans = 0
for r in range(N//R+1):
    tmp = N - r*R
    for g in range(N//G+1):
        ttmp = tmp - g*G
        ans += (ttmp%B == 0 and ttmp >= 0)
print(ans)
# Original solution
r,g,b,n=list(map(int,input().split()))
ctr=0

num_r=n//r+1
num_g=n//g+1

for i in range(num_r):
    for k in range((n-i*r)//g+1):
        if n-r*i-g*k>=0 and (n-r*i-g*k)%b==0:
            ctr+=1
print(ctr)


# Optimized solution
r,g,b,n=list(map(int,input().split()))
ctr=0
l=[r,g,b]
l.sort()
num_1=n//l[2]+1
for i in range(num_1):
    for k in range((n-i*l[2])//l[1]+1):
        if (n-i*l[2]-k*l[1])%l[0]==0:
            ctr+=1
print(ctr)
# 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 - i * r) // g + 1):
        if i * r + j * g > n:
            break
        k = n - (i * r + j * g)

        if k % 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 - i * r) // g + 1):
        k = n - (i * r + j * g)
        if k % 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):
    bB=N-r*R-g*G
    if bB >= 0 and bB%B == 0:
      ans += 1

print(ans)

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

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

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

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

org_list = [R, G, B]
org_list.sort()
first_num = org_list[2]
second_num = org_list[1]
third_num = org_list[0]

count = 0

for i in range(N // first_num + 1):
  if i*first_num > N:
    break
  for j in range((N-i*first_num) // second_num + 1):
    if i*first_num + j*second_num > N:
      break
    if (N - i*first_num - j*second_num) % third_num == 0:
      count += 1
 
print(count)

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

org_list = [R, G, B]
org_list.sort()
first_num = org_list[2]
second_num = org_list[1]
third_num = org_list[0]

count = 0

for i in range(N // first_num + 1):
  for j in range((N-i*first_num) // second_num + 1):
    if (N - i*first_num - j*second_num) % third_num == 0:
      count += 1
 
print(count)
# Original solution
R, G, B, N = list(map(int,  input().split()))
ans = 0
for i in range(3000 // R + 1):
    for j in range(3000 // G + 1):
        tmp = (N - i * R - j * G)
        if tmp % B == 0 and tmp >= 0:
            ans += 1
print(ans)


# Optimized solution
R, G, B, N = list(map(int,  input().split()))
ans = 0
for i in range(3000 // R + 1):
    for j in range(3000 // G + 1):
        tmp = (N - i * R - j * G)
        if tmp % B == 0 and tmp >= 0:
            ans += 1
        elif tmp < 0:
            break
print(ans)
# Original solution
R, G, B, N = list(map(int, input().split()))

count = 0
for i in range(0, N+1, R):
    for j in range(0, N+1, G):
        if (N-i-j) % B == 0 and N >= (i+j):
            count += 1
print(count)

# Optimized solution
R, G, B, N = list(map(int, input().split()))
 
count = len([1 for i in range(0, N+1, R) for j in range(0, N+1, G) if (N-i-j) % B == 0 and N >= (i+j)])
print(count)
# Original solution
# coding: utf-8
# Your code here!

from collections import defaultdict

R, G, B, N = list(map(int, input().rstrip().split(' ')))
A = [R, G, B]

dp = defaultdict(lambda: defaultdict(lambda: -1))
def rec(i, n):
    if dp[i][n] != -1:
        return dp[i][n]
    if n == 0:
        return 1
    if i > 2:
        return 0
        
    #print(i, n)
        
    temp = 0
    for j in range(n // A[i] + 1):
        temp += rec(i + 1, n - j * A[i])
        
    dp[i][n] = temp
    
    return temp
    
print((rec(0, N)))

# Optimized solution
# coding: utf-8
# Your code here!

from collections import defaultdict

R, G, B, N = list(map(int, input().rstrip().split(' ')))
A = [R, G, B]

dp = defaultdict(lambda: defaultdict(lambda: -1))
def rec(i, n):
    if dp[i][n] != -1:
        return dp[i][n]
    if n == 0:
        return 1
    if i == 2:
        return n % A[2] == 0
       
    temp = 0
    for j in range(n // A[i] + 1):
        temp += rec(i + 1, n - j * A[i])
        
    dp[i][n] = temp
    
    return temp
    
print((rec(0, N)))
# 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):
        if (N - i*R - j*G) / B >= 0 and (N - i*R - j*G) % 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):
        if (N - i*R - j*G) % B == 0:
            ans += 1
            
print(ans)
# 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-i*R)//G+1):
            if i*R + j*G +((N-i*R-j*G)//B)*B==N:
                cnt+=1
print(cnt)

# Optimized solution
def main():
    R,G,B,N=list(map(int,input().split()))
    cnt=0
    for i in range(N//R+1):
        cnt+=sum([1 for j in range((N-i*R)//G+1) if i*R + j*G +((N-i*R-j*G)//B)*B==N])
    print(cnt)

main()
# 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 // g + 1):
        m = r * i + g * j
        if m <= n and (n - m) % 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 // g + 1):
        m = r * i + g * j
        if m <= n and (n - m) % b == 0:
            ans += 1
        elif m > n:
            break

print(ans)
# Original solution
r,g,b,n = list(map(int,input().split()))
rgb = sorted([r,g,b])

ans=0
for i in range(n//rgb[2]+1):
    for j in range((n-i*rgb[2])//rgb[1]+1):
        d = n-i*rgb[2]-j*rgb[1]
        if d%rgb[0]==0 and d>=0:
            ans+=1

print(ans)

# Optimized solution
rgb = [0]*3
rgb[0],rgb[1],rgb[2],n = list(map(int,input().split()))
rgb.sort()

ans=0
for i in range(n//rgb[2]+1):
    for j in range((n-i*rgb[2])//rgb[1]+1):
        d = n-i*rgb[2]-j*rgb[1]
        if d%rgb[0]==0 and d>=0:
            ans+=1

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

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

print(ans)
# Original solution
R,G,B,N=list(map(int,input().split()))
ans=[]
if 1<=R<=3000 and 1<=G<=3000 and 1<=B<=3000 and 1<=N<=3000:
	limR=N//R
	for r in range(limR+1)[::-1]:
		zanGB=N-r*R
		limG=zanGB//G
		for g in range(limG+1):
			zanB=zanGB-g*G
			if zanB%B==0:
				b=zanB//B
				ans.append([r,g,b])
print((len(ans)))


# Optimized solution
R,G,B,N=list(map(int,input().split()))
ans=0
if 1<=R<=3000 and 1<=G<=3000 and 1<=B<=3000 and 1<=N<=3000:
	limR=N//R
	for r in range(limR+1)[::-1]:
		zanGB=N-r*R
		limG=zanGB//G
		for g in range(limG+1):
			zanB=zanGB-g*G
			if zanB%B==0:
				b=zanB//B
				ans+=1
print(ans)
# Original solution
R, G, B, N = (int(i) for i in input().split())

c = 0
for r in range(N//R, -1, -1): 
    new1 = N - r*R
    for g in range(new1//G, -1, -1):
        new2 = new1 - g*G
        if new2%B == 0:
            c +=1
    
print(c)

# Optimized solution
def main(R, G, B, N):
    arr = [R, G, B]
    arr.sort(reverse=True)
    R, G, B = arr

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

R, G, B, N = (int(i) for i in input().split())
main(R, G, B, N)
# Original solution
R,G,B,N = list(map(int, input().split()))
index = 0
ans = 0
for_sort = [R,G,B]
for_sort.sort()
r = for_sort[2]
g = for_sort[1]
b = for_sort[0]
while N >= r*index:
  middle = N - r*index
  index += 1
  index2 = 0
  while middle >= g*index2:
    end = middle - g*index2
    index2 += 1
    if end % b == 0:
      ans += 1
print(ans)    

# Optimized solution
R,G,B,N = list(map(int, input().split()))
index = 0
ans = 0
for_sort = [R,G,B]
for_sort.sort()
r = for_sort[2]
g = for_sort[1]
b = for_sort[0]
while N >=0:
  mid = N
  N -= r
  while mid >= 0:
    if mid % b == 0:
      ans += 1
    mid -= g
      
print(ans)
# Original solution
R, G, B, N = list(map(int, input().split()))

cnt = 0

for r in range(3001):
    if r*R > N:
        break
    for g in range(3001):
        if r*R + g*G > N:
            break
        diff = N - (r*R + g*G)
        if divmod(diff, B)[1] == 0:
            cnt += 1

print(cnt)


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

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

while r*R <= N:
    tank = N - r*R
    while True:
        if divmod(tank, B)[1] == 0:
            cnt += 1
        tank -= G
        if tank < 0:
            break
    r += 1

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

# Optimized solution
R, G, B, n = list(map(int, input().split()))
cnt = 0
for r in range(n+1):
    for g in range(n+1):
        bb = n - r*R - g*G
        if bb < 0:
            break
        elif bb%B == 0:
            cnt += 1
print(cnt)
# Original solution
R,G,B,N = list(map(int,input().split()))
ans = 0
for i in range(0,N//R+1):
  for j in range(0,N//G+1):
    k = N - i*R -j*G
    if k%B == 0 and k>= 0:
      ans += 1
print(ans)

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


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

if r >= g and g >= b:
    pass
elif r >= b and b >= g:
    temp = g
    g = b
    b = temp
else:
    temp = r
    r = g
    g = temp

rg = {}
ri = 0
while ri <= n:
    gi = 0
    while gi <= n - ri:
        if (n - ri - gi) % b == 0:
            total = rg.get(ri + gi, 0)
            rg[ri + gi] = total + 1
        else:
            pass
        gi += g
    ri += r

bi = 0
result = 0

while bi <= n:
    total = rg.get(n - bi, 0)
    result += total
    bi += b

print(result)


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

if r >= g and g >= b:
    pass
elif r >= b and b >= g:
    temp = g
    g = b
    b = temp
else:
    temp = r
    r = g
    g = temp

if (r == 1 and g == 1) or (r == 1 and b == 1) or (g == 1 and b == 1):
    rg = [i + 1 for i in range(n + 1)]
elif (r == 1 and g == 2) or (r == 1 and b == 2) or (g == 1 and b == 2) or (r == 2 and g == 1) or (r == 2 and b == 1) or (g == 2 and b == 1):
    rg = [1 + i // 2 for i in range(n + 1)]
else:
    rg = [0 for _ in range(n + 1)]
    ri = 0
    while ri <= n:
        gi = 0
        while gi <= n - ri:
            rg[ri + gi] += 1
            gi += g
        ri += r

bi = 0
result = 0

while bi <= n:
    total = rg[n - bi]
    result += total
    bi += b

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


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


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

# とりうるすべてのr, gの組に関して、条件を満たすbが存在するかを数え上げる
ans = sum(
    N - r * R - g * G >= 0 and (N - r * R - g * G) % B == 0
    for r in range(N // R + 1)
    for g in range((N - r * R) // G + 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 - r * R)//G + 1):
        if r * R + g * G < N and (N - r * R - g * G) % B == 0:
            ans += 1
        if r * R + g * G == N:
            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 - r * R)//G + 1):
        if (N - r * R - g * G) % 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):
        if (n-r*i-g*j) < 0:
            break
        if (n-r*i-g*j)%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):
        if (n-r*i-g*j)%b == 0:
            ans += 1
print(ans)
# Original solution
R, G, B, N = list(map(int, input().split()))

ans = 0
for i in range(3001):
  for j in range(3001):
    v = i * R + j * G
    if N >= v and (N - v) % 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 - i * R) // G + 1):
    ball = i * R + j * G
    if N == ball:
      ans += 1
    elif (N - ball) % B == 0:
      ans += 1

print(ans)
# Original solution
import sys
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
R,G,B,N = LI()
ans = 0
for i in range(N+1):
    for j in range(N+1):
        temp = N-(R*i+G*j)
        if temp>=0 and temp%B==0:
            ans += 1
print(ans)


# Optimized solution
import itertools,sys
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
R,G,B,N = LI()
dp = [0]*(N+1)
dp[0] = 1
for x,i in itertools.product([R,G,B],list(range(N+1))):
    if i-x>=0:
        dp[i] += dp[i-x]
print((dp[-1]))
# Original solution
R,G,B,N = list(map(int,input().split()))
ans = 0
for i in range(0,int(N/R)+1):
  for j in range(0,int(N/G)+1):
    if i*R+j*G<=N and (N-i*R-j*G)%B == 0:
        ans+=1
print(ans)

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


# Optimized solution
R,G,B,N = list(map(int,input().split()))
ans = 0
for i in range(0,N+1,R):
  for j in range(0,N+1,G):
    if i+j<=N:
      if (N-i-j)%B == 0:
        ans+=1
print(ans)
# Original solution
def resolve():
    '''
    code here
    '''

    R, G, B, N = [int(item) for item in input().split()]

    cnt = 0

    for i in range(N+1):
        for j in range(N+1):
            _b = N - (i * R + j * G)
            
            if _b % B == 0 and _b >= 0:
                cnt += 1

    print(cnt)

if __name__ == "__main__":
    resolve()


# Optimized solution
def resolve():
    '''
    code here
    '''

    R, G, B, N = [int(item) for item in input().split()]

    cnt = 0

    for i in range(N+1):
        for j in range(N+1-i):
            _b = N - (i * R + j * G)
            
            if _b % B == 0 and _b >= 0:
                cnt += 1

    print(cnt)

if __name__ == "__main__":
    resolve()
# 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-r*R)//G+1):
        if N-r*R-g*G < 0:
            break
        if N-r*R-g*G >= 0 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-r*R)//G+1):
        if (N-r*R-g*G) % B == 0:
            ans += 1
print(ans)
# Original solution
R, G, B, N = list(map(int, input().split()))
"""
3000以下なので全探索を考える。
まず，全探索できるものは全探索から考える必要がある。
"""

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

# Optimized solution
R, G, B, N = list(map(int, input().split()))
"""
3000以下なので全探索を考える。
まず，全探索できるものは全探索から考える必要がある。
オーダーを計算し，いけそうならそれで行くべき。今回は固定を順にしていくので間に合う
そこから探索する範囲を絞り込んで
"""

count = 0
for r in range(N//R+1):
    rest = N - r*R
    for g in range(rest//G+1):
        n_b = (rest - g*G)
        if n_b % B == 0 and n_b >= 0:
            count += 1
print(count)
# 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//G+1):
        x = i * R
        y = j*G
        z = N - x-y
        if z>= 0 and z%B == 0:
            ans += 1
print((int(ans)))

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

c = 0
for r in range(N + 1):
	if N < r * R:
		break
	for g in range(N + 1):
		if N < r * R + g * G:
			break
		x = (N - r * R - g * G)
		if not x % B and (0 <= (x // B)):
			#print(r, g, b)
			c += 1
print(c)


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

c = 0
for r in range(0, N + 1, R):
	for g in range(0, N + 1, G):
		if N < r + g:
			break
		d = N - r - g
		if not d % B:
			c += 1
	
"""
	for g in range(N + 1):
		if N < r * R + g * G:
			break
		x = (N - r * R - g * G)
		if not (x % B) and (0 <= (x // B)):
			#print(r, g, b)
			c += 1
"""
print(c)
# Original solution
r, g, b, n = [int(i) for i in input().split()]
 
ans = 0
 
for i in range(n + 1):
    for j in range(n + 1):
        if (n - (i * r + j * g)) % b == 0 and (n - (i * r + j * g)) // b >= 0:
            ans += 1
 
print(ans)

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

print(cnt)

# Optimized solution
def main():
    r,g,b,n = list(map(int,input().split()))
    c = 0
    for i in range(n//r+1):
        m = n - r * i
        for j in range(m//g+1):
            l = m - g * j
            if l % b == 0:
                c += 1
            
    print(c)

main()