CodeEff/ECCO huggingface dataset:
# 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):
        check = N - (R*r + G*g)
        if check == 0:
            # print(r, g, check//B, check)
            ans += 1
        elif check > 0 and check%B == 0:
                # print(r, g, check//B, check)
                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):
        check = N - (R*r + G*g)
        if check >= 0 and check%B == 0:
            ans += 1
        # if check == 0:
        #     # print(r, g, check//B, check)
        #     ans += 1
        # elif check > 0 and check%B == 0:
        #         # print(r, g, check//B, check)
        #         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):
        check = (N - (R*r + G*g))/B
        if float.is_integer(check) and check >= 0:
            ans += 1
        # if check >= 0 and check%B == 0:
            # ans += 1
        # if check == 0:
        #     # print(r, g, check//B, check)
        #     ans += 1
        # elif check > 0 and check%B == 0:
        #         # print(r, g, check//B, check)
        #         ans += 1

print(ans)

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


# Optimized solution
R, G, B, N = list(map(int, input().split()))
i = 0
for r in range(N // R + 1):
    Rr = r * R
    for g in range(N // G + 1):
        Gg = g * G
        Bb = N-Rr-Gg
        if Bb < 0:
            break
        if Bb % B == 0:
            i += 1
print(i)
# 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) :
        if (N - (r*R + g*G)) < 0 : continue
        if (N - (r*R + g*G)) % B == 0 :
            ans += 1
            #print(r,g)
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)//G + 1) :
        calc = r*R + g*G
        
        if (N-calc) < 0 :
            break
        
        if (N-calc) % 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-r)//G + 1) :
        calc = r*R + g*G
        if N < calc :
            break
        if (N-calc) % 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)//G + 1) :
        calc = r*R + g*G
        if N < calc :
            break
        if not (N-calc) % B :
            ans += 1
print(ans)
# Original solution
R, G, B, N = list(map(int, input().split()))
l = sorted([R, G, B])[::-1]

count = 0
for l0 in range(N//l[0]+1):
  n0 = N-l0*l[0]
  for l1 in range(n0//l[1]+1):
    l2 = (n0 - l1*l[1])/l[2]
    if l2%1.0 == 0 and l2 >= 0:
      count += 1
print(count)

# Optimized solution
R, G, B, N = list(map(int, input().split()))
l = sorted([R, G, B])[::-1]

count = 0
for l0 in range(N//l[0]+1):
  n0 = N-l0*l[0]
  for l1 in range(n0//l[1]+1):
    l2 = n0 - l1*l[1]
    if l2%l[2] == 0 and l2 >= 0:
      count += 1
print(count)
# Original solution
R, G, B, N = list(map(int, input().split()))

rgb = []
for r in range(N//R + 1):
    for g in range((N - r*R)//G + 1):
        tmp = N-r*R-g*G
        if tmp%B == 0:
            rgb.append((r,g,tmp//B))

print((len(set(rgb))))

# 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):
        tmp = N-r*R-g*G
        if tmp%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 - r*R)//G + 1):
        tmp = N-r*R-g*G
        if tmp%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()))
LIM = 3003
ans = 0
for r in range(LIM):
    for g in range(LIM):
        if R * r + G * g > N:
            break
        Bb = N - R * r - G * g
        if Bb % B == 0:
            ans += 1
print(ans)


# Optimized solution
def solve():
    R, G, B, N = list(map(int, input().split()))
    LIM = 3001
    ans = 0
    for r in range(LIM):
        for g in range(LIM):
            if R * r + G * g > N:
                break
            Bb = N - R * r - G * g
            if Bb % B == 0:
                ans += 1
    return ans


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

ans = 0
n_iter_r = N//R + 1
n_iter_g = N//G + 1

for r in range(n_iter_r):
    for g in range(n_iter_g):
        if N - R*r - G*g < 0:
            break
        else:
            if (N - R*r - G*g)%B==0:
                ans += 1

print(ans)

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

ans = 0
n_iter_r = N//R + 1
n_iter_g = N//G + 1

for r in range(n_iter_r):
    for g in range(n_iter_g):
        nokori = N - R*r - G*g
        if nokori < 0:
            break
        else:
            if nokori%B==0:
                ans += 1

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

# Optimized solution
r,g,b,n = list(map(int,input().split()))
a = [0]*(n+1)
a[0] = 1
for i in [r,g,b]:
    for j in range(n+1-i):
        a[j+i]+=a[j]
print((a[n]))
# Original solution
R, G, B, N = [int(n) for n in input().split()]

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

print(count)

# Optimized solution
R, G, B, N = [int(n) for n in input().split()]

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

print(count)
# Original solution
R, G, B, N = [int(n) for n in input().split()]

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

print(count)

# Optimized solution
R, G, B, N = [int(n) for n in input().split()]

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

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

count = 0

for r in range(0, N//R+1):    
    for g in range(0, N//G+1):
        # compute b
        b = (N - r*R - g*G) / B
        
        # judge
        if b.is_integer() and 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):

  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 = [int(i) for i in input().split()]

ans = 0

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

print(ans)

# Optimized solution
def trans(n, dp, color):
    for i in range(n-color+1):
        dp[i+color] += dp[i]
    return dp

def main():
    r, g, b, n = [int(i) for i in input().split()]
    dp = [0 for i in range(n+1)]
    dp[0] = 1
    dp = trans(n, dp, r)
    dp = trans(n, dp, g)
    dp = trans(n, dp, b)
    print((dp[-1]))

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

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

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

solve()
# Original solution
a = [0]*3
a[0],a[1],a[2],n = list(map(int,input().split()))
a.sort()
cnt = 0
for i in range(n//a[2]+1):
    for j in range(n//a[1]+1):
        d = n-a[2]*i-a[1]*j
        if d%a[0] == 0 and d >= 0:
            cnt += 1
print(cnt)


# Optimized solution
a = [0]*3
a[0],a[1],a[2],n = list(map(int,input().split()))
a.sort()
cnt = 0
for i in range(n//a[2]+1):
    for j in range((n-i*a[2])//a[1]+1):
        d = n-a[2]*i-a[1]*j
        if d%a[0] == 0 and d >= 0:
            cnt += 1
print(cnt)
# Original solution
def input_from_console():
    r, g, b, n = list(map(int, input().split()))

    return r, g, b, n


def main():
    r, g, b, n = input_from_console()
    counter = 0
    r, g, b = sorted([r, g, b], reverse=True)
    # print(r,g,b)
    for i1 in reversed(list(range(int(n / r) + 1))):
        n1 = n - r * i1
        for i2 in reversed(list(range(int(n1 / g) + 1))):
            n2 = n1 - g * i2
            # print(n2, i1, i2)
            if r * i1 + g * i2 + b * (n - i1 - i2) < n2:
                continue
            for i3 in reversed(list(range(int(n2 / b) + 1))):
                # print(i1, i2, i3, r * i1 + g * i2 + b * i3)
                n_new = r * i1 + g * i2 + b * i3
                if r * i1 + g * i2 + b * i3 == n:
                    counter += 1
                    break
                elif n_new < n:
                    break

    print(counter)


if __name__ == "__main__":
    main()

# Optimized solution

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

    return r, g, b, n


def main():
    r, g, b, n = input_from_console()
    counter = 0
    r, g, b = sorted([r, g, b], reverse=True)
    for i1 in reversed(list(range(int(n / r) + 1))):
        n1 = n - r * i1
        for i2 in reversed(list(range(int(n1 / g) + 1))):
            n2 = n1 - g * i2
            if n2 % b == 0:
                counter += 1
    print(counter)


if __name__ == "__main__":
    main()
# Original solution
r,g,b,n=list(map(int,input().split()))
cnt=0
s=0
for i in range(n//r+1):
    for j in range(n//g+1):
        k=(n-(i*r+j*g))//b
        s=i*r+j*g+k*b
        if s==n and k>=0:
            cnt+=1
print(cnt)

# Optimized solution
# 2019/10/17

R,G,B,n=list(map(int,input().split()))
cnt=0
for i in range(n//R+1):
    r=i*R
    rem=n-r
    for j in range((n-r)//G+1):
        g=j*G
        b=n-(r+g)
        if b%B:continue
        cnt+=1
print(cnt)
# Original solution
#%%
r, g, b, n = list(map(int, input().split()))
ans = 0
for i in range(n//r+2):
    flag = False
    for j in range(n//g+2):
        tmp = n - (r*i + g*j)
        if j == 0 and tmp < 0:
            flag = True
        if tmp < 0:
            break 
        if tmp % b == 0:
            ans += 1
    if flag:
        break

print(ans)

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

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

# Optimized solution
*j, n = list(map(int, input().split()))
j.sort()
a, b, c = j
count = 0
for y in range(n//b+1):
    for z in range((n-y*b)//c+1):
        if (n - b*y - c*z) % a == 0:
            count += 1
print(count)
# Original solution
r, g, b, n = list(map(int, input().split()))
r_num = n // r
g_num = n // g
b_num = n // b
count = 0
for i in range(r_num+1):
    r_remain = n - r * i
    if r_remain == 0:
        count += 1
    else:
        for j in range(g_num+1):
            g_remain = r_remain - g * j
            if g_remain == 0:
                count += 1
            elif g_remain > 0:
                if g_remain % b == 0:
                    count += 1
print(count)

# Optimized solution
r, g, b, n = list(map(int, input().split()))
count = 0
for i in range(0, n+1, r):
    rem = n-i
    for j in range(0, rem+1, g):
        if (rem-j)%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 - i * r) // g + 1):
    if (n - r * i - g * j) / b == abs(int((n - r * i - g * j) / b)):
      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 and (n - r * i - g * j) // b >= 0:
      ans += 1
print(ans)
# Original solution
import sys

input = sys.stdin.readline


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

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


if __name__ == "__main__":
    main()


# Optimized solution
import sys

input = sys.stdin.readline


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

    dp = [0] * (N + 1)
    dp[0] = 1
    for c in [R, G, B]:
        for i in range(N - c + 1):
            dp[i + c] += dp[i]

    ans = dp[N]
    print(ans)


if __name__ == "__main__":
    main()
# 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-r*R):
        
        ball =  r*R+g*G  
        
        res = N-ball
        
        if  res >=0  and res%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-r*R):
        
        res = N- (r*R+g*G) 
        
        if  res >=0 and res%B ==0:
            cnt+=1
    
print(cnt)
# Original solution
R,G,B,N=list(map(int,input().split()))
dp=[0]*(N+1)
dp[0]=1
for C in (R,G,B):
  for i in range(len(dp)-C):
    if dp[i]!=-1:
        dp[i+C]=dp[i]+dp[i+C]
print((dp[N]))


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

# Optimized solution
r,g,b,n=list(map(int,input().split()))
c=0
for i in range(-(-n//r)+1):
  for j in range(-(-n//g)+1):
    x=n-(i*r+j*g)
    if x<0:
      break
    elif x%b==0:
      c+=1
print(c)
# Original solution
import math
R, G, B, N = list(map(int, input().split()))
rg_lis = []
ans = 0
cr = math.ceil(N/R)
cg = math.ceil(N/G)
cb = math.ceil(N/B)
for i in range(cr + 1):
    for j in range(cg + 1):
        tmp =  i * R + j * G
        if N - tmp >= 0:
            rg_lis.append(tmp)
        else:
          break
for l in rg_lis:
    if (N - l )% B == 0:
        ans += 1
print(ans)


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

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


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

ans = 0
for i in range(int(N / R) + 1):
    for j in range(int((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()))

RL=(N+R-1)//R
if RL*R>N:
    RL=RL-1

cnt=0
for r in range(RL+1):
    GL=(N-r*R+G-1)//G
    for g in range(GL+1):
        if (r*R+g*G)>N:continue
        if (N-r*R-g*G)%B==0:
            cnt+=1

print(cnt)

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

RL=(N+R-1)//R
if RL*R>N:
    RL=RL-1

cnt=0
for r in range(RL+1):
    GL=(N-r*R+G-1)//G
    if (r*R+GL*G)>N:
        GL=GL-1
    for g in range(GL+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

for r in range(N//R+1):
	for g in range(N+1):
		b = (N - R * r - G * g) / B
		if b.is_integer() and 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
# -*- coding: utf-8 -*-
import sys
import math
from bisect import bisect_left
from bisect import bisect_right
import collections
import copy
input = sys.stdin.readline
 
# bisect_left(lists, 3)
# bisect_right(lists, 3)
 
def main():
	R, G, B, N = list(map(int, input().split(" ")))
	
	ans = 0
	for i in range(N+1):
		r = i * R
		for j in range(N+1):
			g = j * G
			if N - r - g < 0:
				continue
			if (N - r - g) % B != 0:
				continue
			k = (N - r - g) // B
			#print("{} {} {}".format(i, j, k))
			ans += 1
			

	print(ans)

	
	
if __name__ == "__main__":
	main()

# Optimized solution
# -*- coding: utf-8 -*-
import sys
import math
from bisect import bisect_left
from bisect import bisect_right
import collections
import copy
input = sys.stdin.readline
 
# bisect_left(lists, 3)
# bisect_right(lists, 3)
 
def main():
	R, G, B, N = list(map(int, input().split(" ")))
	
	ans = 0
	for i in range(N+1):
		r = i * R
		for j in range(N+1):
			g = j * G
			if N - r - g < 0:
				continue
			if (N - r - g) % B != 0:
				continue
			#k = (N - r - g) // B
			#print("{} {} {}".format(i, j, k))
			ans += 1
			

	print(ans)

	
	
if __name__ == "__main__":
	main()
# Original solution
def b_rgb_boxes(R, G, B, N):
    """Rr+Gg+Bb=N となる整数(r, g, b)の組はいくつか。"""
    ans = 0
    for r in range(N + 1):
        for g in range(N + 1):
            t = N - R * r - G * g
            if t >= 0 and (t % B == 0):
                ans += 1
    return ans

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

# Optimized solution
def b_rgb_boxes(R, G, B, N):
    """Rr+Gg+Bb=N となる非負整数(r, g, b)の組はいくつか。"""
    # dp[i]: Rr+Gg+Bb=i となる非負整数(r, g, b)の組はいくつか
    dp = [0] * (N + 1)
    dp[0] = 1
    for c in (R, G, B):
        for i in range(N + 1):
            if i + c <= N:
                # Rr+Gg+Bb=i を達成する組のそれぞれに対して、
                # R,G,Bのどれかを足すと Rr+Gg+Bb=i+c を達成できる
                dp[i + c] += dp[i]
    return dp[N]

R, G, B, N = [int(i) for i in input().split()]
print((b_rgb_boxes(R, G, B, N)))
# Original solution
import sys
from functools import lru_cache, cmp_to_key
from heapq import merge, heapify, heappop, heappush
from math import *
# import math
from collections import defaultdict as dd, deque, Counter as C
from itertools import combinations as comb, permutations as perm
from bisect import bisect_left as bl, bisect_right as br, bisect
from time import perf_counter
from fractions import Fraction
# sys.setrecursionlimit(int(pow(10, 2)))
# sys.stdin = open("input.txt", "r")
# sys.stdout = open("output.txt", "w")
mod = int(pow(10, 9) + 7)
mod2 = 998244353
def data(): return sys.stdin.readline().strip()
def out(*var, end="\n"): sys.stdout.write(' '.join(map(str, var))+end)
def l(): return list(sp())
def sl(): return list(ssp())
def sp(): return list(map(int, data().split()))
def ssp(): return list(map(str, data().split()))
def l1d(n, val=0): return [val for i in range(n)]
def l2d(n, m, val=0): return [l1d(n, val) for j in range(m)]





# @lru_cache(None)


r,g,b,n=l()
ans=0
r,g,b=sorted([r,g,b])[::-1]
for i in range(n//r+1):
    for j in range(n//g+1):
        k=n-i*r-j*g
        if(k<0):
            break
        if(k>=0 and k%b==0):
            ans+=1
print(ans)

# Optimized solution

r,g,b,n=list(map(int,input().split()))
ans=0
r,g,b=sorted([r,g,b])[::-1]
for i in range(n//r+1):
    for j in range(n//g+1):
        k=n-i*r-j*g
        if(k<0):
            break
        if(k>=0 and k%b==0):
            ans+=1
print(ans)
# Original solution
r, g, b, n = list(map(int, input().split()))
cnt = 0
for red in range(n // r + 1):
    for green in range(n // g + 1):
        blue = n - red * r - green * g
        if blue >= 0 and blue % b == 0:
            cnt += 1
print(cnt)

# Optimized solution
r, g, b, n = list(map(int, input().split()))
cnt = 0
for red in range(n // r + 1):
    for green in range((n - r * red) // g + 1):
        blue = n - red * r - green * g
        if blue >= 0 and blue % b == 0:
            cnt += 1
print(cnt)
# Original solution
import math
r,g,b,n=list(map(int, input().split())) 
count=0
k=[]
for i in range(n+1):
    for j in range(n+1):
        if n-(i*g+j*r)>=0:
            k.append(i*g+j*r)
        else:
            break
     
for i in range(len(k)):
    if (n-k[i])%b==0:
        count+=1
            
print(count)
            
    
    
            
                
    
        

     

    

     

    


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

x=n//r
y=n//g
ans=0
for i in range(x+1):
    for j in range(y+1):
        v=n-r*i-g*j
        if v<0:
            continue
        else:
            if v%b==0:
                ans+=1
print(ans)
# Original solution
def main():
    R, G, B, N = [int(x) for x in input().split()]

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

    print(ct)

if __name__ == "__main__":
    main()

# Optimized solution
def main():
    R, G, B, N = [int(x) for x in input().split()]

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

    print(ct)

if __name__ == "__main__":
    main()