CodeEff/ECCO huggingface dataset:
# Original solution
r, g, b, n = list(map(int, input().split()))
s_rgb = sorted([r, g, b], reverse=True)
count = 0
for i in range(int(n / s_rgb[0]) + 1)[::-1]:
    for j in range(int((n - s_rgb[0] * i) / s_rgb[1]) + 1)[::-1]:
        tmp = n - s_rgb[0] * i - s_rgb[1] * j
        if (tmp >= 0 and tmp % s_rgb[2] == 0):
            count += 1
print(count)


# Optimized solution
R, G, B, N = [int(i) for i in input().split()]
dp = [0] * (N + 1)
dp[0] = 1
for c in (R, G, B):
    for i in range(N + 1 - c):
        dp[i + c] += dp[i]
print((dp[N]))
# Original solution
R, G, B, N = list(map(int, input().split()))
ans = 0
for r in range(3001):
    if R * r > N:
        break
    for g in range(3001):
        if R * r + G * g > N:
            break
        elif (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()))

def f(a, b):
    sho, amari = int(a/b), a%b
    return sho, amari

R_s, R_a = f(N, R)

cnt = 0

for i in range(R_s + 1):
    x = R_a + i * R # R を i 個使う
    G_s, G_a = f(x, G)
    for j in range(G_s + 1):
        y = G_a + j * G # G を j 個使う
        B_s, B_a = f(y, B)
        if B_a == 0:
            cnt += 1

print(cnt)





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

def f(a, b):
    sho, amari = int(a/b), a%b
    return sho, amari


def ans(l, m, s):
    cnt = 0

    R_s, R_a = f(N, l)

    for i in range(R_s + 1):
        x = R_a + i * l # R を i 個使う
        G_s, G_a = f(x, m)
        for j in range(G_s + 1):
            y = G_a + j * m # G を j 個使う
            if y % s == 0:
                cnt += 1
    return cnt

li = [R, G, B]
li.sort(reverse=True)

cnt = ans(li[0], li[1], li[2])

print(cnt)
# Original solution
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)


# Optimized solution
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)
# 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):
        z = r * i + g * j
        if z <= n and (n - z) % b == 0:
            ans += 1
print(ans)            


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

ans = 0
for i in range(n+1):
    x = n - r * i
    for j in range(x+1):
        y = x - g * j
        if y >= 0 and y % 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-r*R)//G+1):
		n=N-R*r-G*g
		if n%B==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):
	n=N-r*R
	for g in range(n//G+1):
		n1=n-G*g
		if n1%B==0 and n1//B>=0:
			cnt += 1

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

# Optimized solution
A,B,C,N= list(map(int,input().split()))
ans=0
for i in range(0,N//A+1):
   for j in range(0,(N-i*A)//B+1):
      if (N-i*A-j*B)%C==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//g+1):
    if 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):
  t = n - r*i
  for j in range(t//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):
  t = n - r*i
  for j in range(t//g+1):
    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):
  t = n - r*i
  for j in range(t//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 r in range(3001):
    for g in range(3001):
        if (R*r+G*g) > N:
            break

        if (N-(R*r+G*g)) % B == 0 or 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(3001):
    for g in range(3001):
        tmp = (R*r+G*g)
        if tmp > N:
            break

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

print(count)

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

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


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


# Optimized solution
R, G, B, N = list(map(int, input().split()))
count = 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:
            count += 1
print(count)
# Original solution
R, G, B, N = list(map(int,input().split()))

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

print(cnt)

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

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

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

print(num)

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

print(num)
# Original solution
from bisect import bisect_left
def index(a, x):
    i = bisect_left(a,x)
    if i != len(a) and a[i] == x:
        return True
    return False

R, G, B, N = list(map(int,input().split()))
listB = [ i for i in range(N//B+1) ]
cnt = 0
for r in range(N//R+1):
    for g in range((N-R*r)//G+1):
        v = R*r+G*g
        if (N - v)%B == 0 and index(listB,(N - v)//B):
            cnt += 1
print(cnt)


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

count = 0
for i in range(N // R + 1):
    tmp = N - i * R
    for j in range(N // G + 1):
        tmp2 = tmp - j * G
        if tmp2 < 0:
            continue
        if tmp2 % B == 0:
            count += 1

print(count)

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

count = 0
tmp1 = N + R
for i in range(N // R + 1):
    tmp1 -= R
    tmp2 = tmp1 + G
    for j in range(N // G + 1):
        tmp2 -= G
        if tmp2 < 0:
            continue
        if tmp2 % B == 0:
            count += 1

print(count)
# Original solution
data = list(map(int, input().split()))
R = data[0]
G = data[1]
B = data[2]
N = data[3]

# R * a + G * b + B * c 

a = N // R + 1
b = N // G + 1
# c = N // B + 1
res = 0

for Ri in range(a):
    Rx = Ri * R
    if Rx > N:
        break
    for Gi in range(b):
        Gx = Gi * G
        if Rx + Gx > N:
            break
        if (N - Rx - Gx) % B == 0:
            res = res + 1

print(res)


# Optimized solution
data = list(map(int, input().split()))
R = data[0]
G = data[1]
B = data[2]
N = data[3]

# R * a + G * b + B * c 

a = N // R + 1
b = N // G + 1
# c = N // B + 1
res = 0

def check(Ri):
    global res
    Rx = Ri * R
    if Rx > N:
        return
    for Gi in range(b):
        Gx = Gi * G
        if Rx + Gx > N:
            break
        if (N - Rx - Gx) % B == 0:
            res = res + 1

[check(Ri) for Ri in range(a)]

print(res)
# Original solution
R, G, B, N = list(map(int,input().split()))
count = 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)>=0:
            count += 1
print(count)

# Optimized solution
R, G, B, N = list(map(int,input().split()))
count = 0
i_range = N//R+1
j_range = N//G+1

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)>=0:
            count += 1
print(count)
# Original solution
# -*- coding: utf-8 -*-


def main():
    r, g, b, n = list(map(int, input().split()))
    comb = list()
    ans = 0

    for i in range(3000 + 1):
        for j in range(3000 + 1):
            comb.append(r * i + g * j)

    for c in comb:
        if (n - c) >= 0 and (n - c) % b == 0:
            ans += 1

    print(ans)


if __name__ == '__main__':
    main()


# Optimized solution
# -*- coding: utf-8 -*-


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

    for i in range(3000 + 1):
        for j in range(3000 + 1):
            diff = n - (r * i + g * j)

            if diff >= 0 and (diff % b == 0):
                ans += 1

    print(ans)


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

cnt = 0
for r in range(N//R+1):
    Rr = R*r
    for g in range((N-Rr)//G+1):
        if (N-(R*r + G*g)) % 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):
    Rr = R*r
    for g in range((N-Rr)//G+1):
        if (N-(Rr + G*g)) % B == 0:
            cnt += 1
print(cnt)
# Original solution


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

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



if(C==[1,1,1]):
	print(((N+2)*(N+1)//2))







count=0
for i in range(N//C[2]+1):
	for j in range(N//C[1]+1):
		if(N-C[2]*i-C[1]*j>=0 and (N-C[2]*i-C[1]*j)%C[0]==0):
			count+=1
print(count)



# Optimized solution


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

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



if(C==[1,1,1]):
	print(((N+2)*(N+1)//2))
	exit()






count=0
for i in range(N//C[2]+1):
	for j in range(N//C[1]+1):
		if(N-C[2]*i-C[1]*j>=0 and (N-C[2]*i-C[1]*j)%C[0]==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):
  if R * r > N: continue
  for g in range((N-r*R)//G+1):
    if R*r + G*g > N: break
    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

a = max(R, G, B)
if a == R:
  b = max(G, B)
elif a == G:
  b = max(B, R)
else:
  b = max(R, G)
c = min(R, G, B)
for i in range(N//a+1):
  for j in range((N-a*i)//b+1):
    if ((N-a*i)-b*j)%c == 0:
      ans += 1
print(ans)
# Original solution
import itertools
R,G,B,n = list(map(int, input().split()))
ans = 0
for r in range(n//R+1):
    if R*r > n: break
    for g in range(n//G+1):
        ball = R*r + G*g
        if ball > n or (n-ball)%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):
    if R*r > n: break
    for g in range(n//G+1):
        ball = R*r + G*g
        if ball > n: break
        if (n-ball)%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//G+1):
       r,g = i*R, j*G
       if (N-r-g)%B!=0 or r+g > N: continue
       cnt += 1
print(cnt)

# Optimized solution
R,G,B,N = list(map(int, input().split()))
cnt = 0
for r in range(0,N+1,R):
    for g in range(0,N+1,G):
        if r+g > N:break
        if (N-r-g)%B==0: cnt += 1
print(cnt)
# Original solution
r,g,b,n=list(map(int,input().split()))
count=0
for ri in range(int(n/r)+1):
    for gi in range(int(n/g)+1):
        sumc=n-ri*r-gi*g
        if sumc<0:
            break
        if sumc%b==0 and sumc/b>=0:
            count+=1
print(count)


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

count=0
for ri in range(int(n/r)+1):
    for gi in range(int((n-ri*r)/g)+1):
        sumc=n-ri*r-gi*g
        if sumc<0:
            break
        if sumc%b==0:
            count+=1

print(count)
# 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):
        if  (N - r*R - g*G) >= 0 and  (N - r*R - g*G)%B == 0 :
            cnt +=1
            #print(r,g,(N - r*R - g*G)//B)
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//G+1):
        if  (N - r*R - g*G) < 0:
            break
        if  (N - r*R - g*G)%B == 0 :
            cnt +=1
            #print(r,g,(N - r*R - g*G)//B)
print(cnt)
# Original solution
from math import floor

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

cnt = 0
for r0 in range(floor(n // r)+1):
  for g0 in range(floor(n // g)+1):
    sum = r * r0 + g * g0
    if sum > n:
      continue
    if (n - sum) % b == 0:
      cnt += 1

print(cnt)
      

# Optimized solution
from math import floor

r, g, b, n = list(map(int, input().split()))
r, g, b = sorted([r, g, b])[::-1]

cnt = 0
for r0 in range(floor(n // r)+1):
  for g0 in range(floor((n-r*r0)// g)+1):
    sum = r * r0 + g * g0
    if sum > n:
      continue
    if (n - sum) % b == 0:
      cnt += 1

print(cnt)
# Original solution
R,G,B,n=list(map(int,input().split()))
i=0
ans=0
while(R*i<=n):
  j=0
  while(R*i+G*j<=n):
    if((n-R*i-G*j)%B==0):
      ans+=1
    j+=1
  i+=1
print(ans)

# Optimized solution
R,G,B,n=list(map(int,input().split()))
i=0
ans=0
for i in range(int(n/R)+1):
  for j in range(int((n-i*R)/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()))
cnt=0
for r in range((N//R)+1):
    for g in range(((N-R*r)//G)+1):
        if (N-R*r-G*g)<0: continue
        if (N-R*r-G*g)%B==0:
            cnt=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=cnt+1
print (cnt)
# Original solution
# diverta 2019 Programming Contest: B – RGB Boxes
R, G, B, N = [int(i) for i in input().split()]

bingo = 0

for r in range(0, 3001):
    for g in range(0, 3001):
        b = (N -(R * r + G * g)) // B
        if b >= 0 and  R * r + G * g + B * b == N:
            bingo += 1

print(bingo)

# Optimized solution
# diverta 2019 Programming Contest: B – RGB Boxes
R, G, B, N = [int(i) for i in input().split()]

bingo = 0

for r in range(0, 3001):
    for g in range(0, 3001):
        b = (N -(R * r + G * g)) // B
        if b < 0:
            break
        elif R * r + G * g + B * b == N:
            bingo += 1

print(bingo)
# Original solution
# diverta 2019 Programming Contest: B – RGB Boxes
R, G, B, N = [int(i) for i in input().split()]

bingo = 0

for r in range(0, 3001):
    for g in range(0, 3001):
        b = (N -(R * r + G * g)) // B
        if b < 0:
            break
        elif R * r + G * g + B * b == N:
            bingo += 1

print(bingo)

# Optimized solution
# diverta 2019 Programming Contest: B – RGB Boxes
R, G, B, N = [int(i) for i in input().split()]

bingo = 0

for r in range(0, 3001):
    if R * r > N:
        break
    else:
        for g in range(0, 3001):
            b = (N -(R * r + G * g)) // B
            if b < 0:
                break
            elif R * r + G * g + B * b == N:
                bingo += 1

print(bingo)
# Original solution
# diverta 2019 Programming Contest: B – RGB Boxes
R, G, B, N = [int(i) for i in input().split()]

bingo = 0

for r in range(N + 1):
    if R * r > N:
        break
    for g in range(N + 1):
        b = (N - (R * r + G * g)) // B
        if b >= 0 and R * r + G * g + B * b == N:
            bingo += 1

print(bingo)

# Optimized solution
# diverta 2019 Programming Contest: B – RGB Boxes
R, G, B, N = [int(i) for i in input().split()]

bingo = 0

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

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

ans = 0

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

print(ans)

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

ans = 0

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

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

ans = 0

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

print(ans)

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

dp = [0 for i in range(n+1)]
dp[0] = 1

for i in range(r, n+1, r):
    dp[i] = 1
for i in range(g, n+1):
    dp[i] += dp[i-g]
for i in range(b, n+1):
    dp[i] += dp[i-b]

print((dp[-1]))
# Original solution
R, G, B, N = list(map(int, input().split()))
ans = 0

for r in range(3001):
    for g in range(3001):
        v = R * r + G * 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 r in range(min(3000, 3000 // R) + 1):
    for g in range(min(3000, 3000 // G) + 1):
        v = R * r + G * g
        if N >= v and (N - v) % B == 0:
            ans += 1

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

for r in range(min(3000, 3000 // R) + 1):
    for g in range(min(3000, 3000 // G) + 1):
        v = R * r + G * 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 r in range(min(3000, 3000 // R) + 1):
    if R * r <= N:
        for g in range(min(3000, 3000 // G) + 1):
            v = R * r + G * g
            if N >= v and (N - v) % B == 0:
                ans += 1

print(ans)
# Original solution
a,b,c,n=list(map(int,input().split()))
d=[a,b,c]
d.sort()
a=d[0]
b=d[1]
c=d[2]
e=0
for i in range(0,int(n/c)+1):
  f=n-c*i
  for k in range(0,int(f/b)+1):
    g=f-b*k
    if g/a-int(g/a)==0:
        e=e+1
print(e)

# Optimized solution
a,b,c,n=list(map(int,input().split()))
d=[a,b,c]
d.sort()
a=d[0]
b=d[1]
c=d[2]
e=0
for i in range(0,n//c+1):
    for k in range(0,(n-c*i)//b+1):
        if ((n-c*i-b*k)%a)==0:
            e=e+1
print(e)
# Original solution
import sys, re

def input(): return sys.stdin.readline().strip()
def INT(): return int(eval(input()))
def MAP(): return list(map(int, input().split()))
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
MOD = 10 ** 9 + 7


R, G, B, N = MAP()
count = 0
for i in range(N+1):
	for j in range(int((N-i*R)//G)+1):
		# print(r, g, b)
		if R*i + G*j + B*int(max(0, (N - i*R - j*G))/B) == N:
			count += 1
print(count)


# Optimized solution
import sys, re

def input(): return sys.stdin.readline().strip()
def INT(): return int(eval(input()))
def MAP(): return list(map(int, input().split()))
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
MOD = 10 ** 9 + 7


R, G, B, N = MAP()
count = 0
for i in range(N+1):
	for j in range(int((N-i*R)//G)+1):
		# print(r, g, b)
		# if R*i + G*j + B*int(max(0, (N - i*R - j*G))/B) == N:
		# 	count += 1
		if (N - i*R - j*G) % B == 0:
			count += 1
print(count)
# Original solution
R, G, B, N = tuple(map(int, input().split()))
ans = 0
for i in range(N//R+1):
    for j in range(N//G+1):
        rest = (N - R * i - G * j)
        if (0 <= rest) and rest % B == 0:
            ans += 1
print(ans)

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

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

print(count)

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

for r in range(int(N / R) + 1):
    for g in range(int(N / G) + 1):
        x = N - r * R - g * G
        if x < 0:
            break
        if x >= 0 and x % B == 0:
            count = 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):
    b=(N-r*R-g*G)/B
    if b.is_integer() and b>=0:
      ans+=1
      #print(r,g,b)  
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()))

num = 0
ans = 0
for r in range(N+1):
    numR = R*r
    if numR > N: continue
    for g in range(N+1):
        numG = numR + G*g
        if numG > N: continue
        b = (N-numG) / B
        if int(b) == b 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+1):
    for g in range((N-r*R)//G+1):
        b0 = N-r*R-g*G
        if b0 % B == 0:
            ans += 1

print(ans)