CodeEff/ECCO huggingface dataset:
# Original solution
R, G, B, N = list(map(int, input().split()))
count = 0
for r in range(0, N+1, R):
  for g in range(0, N+1, G):
    val = (N - r - g)
    if val % B == 0 and val >= 0:
      count += 1
print(count)

# Optimized solution
R, G, B, N = list(map(int, input().split()))
count = 0
for r in range(0, N+1, R):
  for g in range(0, N+1-r, G):
    val = (N - r - g)
    if val % B == 0 and val >= 0:
      count += 1
print(count)
# Original solution
from sys import stdin
R, G, B, N = (int(i) for i in input().split())

count = 0
for i in range(N+1):
    for j in range(N+1):
        b = (N-i*R-j*G)/B
        if b.is_integer() and b >= 0:
            count +=1

print(count)


# Optimized solution
from sys import stdin
R, G, B, N = (int(i) for i in input().split())

count = 0
for i in range(N+1):
    N1 = N - i*R
    for j in range(N1+1):
        b = (N1 - j*G)/B
        if b.is_integer() and b >= 0:
            count +=1

print(count)
# Original solution
from sys import stdin
R, G, B, N = (int(i) for i in input().split())

count = 0
for i in range(N+1):
    for j in range(N+1):
        b = (N-i*R-j*G)/B
        if b.is_integer() and b >= 0:
            count +=1

print(count)


# Optimized solution
from sys import stdin
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):
        if i + c <= N:
            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(N+1):
  for g in range(N+1):
    if (N - r*R - g*G) % B == 0 and (N - r*R - 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//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 cnt2(sum, a, b):

cnt = 0
for rr in range(n // r + 1):
  sum = r * rr
  rest = n - sum
  #cnt += cnt2(rest, g, b)
  for gg in range(rest // g + 1):
    sum = r * rr + g * gg
    rest = n - sum
    if rest < 0:
      break
    if rest % b == 0:
      bb = (n-sum) // b
      cnt += 1

print(cnt)


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

cnt = 0
for rr in range(n // r + 1):
  for gg in range((n - r * rr) // g + 1):
    rest = n - r * rr - g * gg
    cnt += (rest % b == 0)

print(cnt)
# 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: continue
    if (N-R*r-G*g)%B!=0: continue
    ans+=1
print(ans)

# Optimized solution
def input_list():
  return list(map(int, input().split()))

def main():
  r, g, b, n = input_list()
  ans = 0
  for x in range(n//r+1):
    for y in range(n//g+1):
      rr = r*x
      gg = g*y
      if rr + gg > n:
        continue
      bb = (n - rr - gg)
      if bb % b != 0:
        continue
      ans += 1
  print(ans)

main()
# Original solution
# -*- coding: utf-8 -*-
in_r, in_g, in_b, n = list(map(int, input().split()))

ans = 0

in_list= [in_r,in_g,in_b]
sorted_list = sorted(in_list)

r = sorted_list[-1]
g = sorted_list[-2]
b = sorted_list[-3]

max_r = n // r

for i in range(max_r+1):
    tmp = n - (r * i)
    max_g = tmp // g
    after_r = tmp
    for j in range(max_g+1):
        tmp = after_r
        tmp = tmp - (g * j)
        max_b = tmp // b
        after_g = tmp
        if tmp%b == 0:
            ans = ans + 1

print(ans)

# Optimized solution
# -*- coding: utf-8 -*-
in_r, in_g, in_b, n = list(map(int, input().split()))

ans = 0

in_list= [in_r,in_g,in_b]
sorted_list = sorted(in_list)

r = sorted_list[-1]
g = sorted_list[-2]
b = sorted_list[-3]

max_r = n // r

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

counter = 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:
            b = int((N - R * r - G * g) / B)
            #print(r,g,b)
            if b >= 0:
                counter += 1
print(counter)

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

counter = 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:
            counter += 1
print(counter)
# 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):
        rem = N - (r * R + g * G)
        if rem == 0 or (rem > 0 and rem % 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 + 1):
        rem = N - (r * R + g * G)
        if rem < 0:
            break
        if rem == 0 or (rem > 0 and rem % 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):
        V = N - (r * R + g * G)
        if V >= 0 and V % 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):
        V = N - (r * R + g * G)
        if V >= 0 and V % B == 0:
            cnt += 1
print(cnt)
# Original solution
R, G, B, N = list(map(int, input().split()))
color = [R, G, B]
color.sort(reverse = True)
maxr = N // color[0]
maxg = N // color[1]
count = 0
for i in range(maxr+1):
    for j in range(maxg+1):
        nokori = N - i * color[0] - j * color[1]
        amari = nokori % color[2]
        if nokori >= 0 and amari == 0:
            count += 1
print(count)


# Optimized solution
R, G, B, N = list(map(int, input().split()))
color = [R, G, B]
color.sort(reverse = True)
maxr = N // color[0]
count = 0
for i in range(maxr+1):
    nokori = N - i * color[0]
    maxg = nokori // color[1]
    for j in range(maxg+1):
        nokorinow = nokori - j * color[1]
        amari = nokorinow % color[2]
        if amari == 0:
            count += 1

print(count)
# Original solution


R, G, B, N = list(map(int, input().split()))
rgb = []
for i in range(N + 1):
    for j in range(N - i + 1):
        key = i * R + j * G
        key = N - key
        if key % B == 0 and key / B >= 0:
            rgb.append([i, j, key // B])

#print(rgb)
print((len(rgb)))

# Optimized solution


R, G, B, N = list(map(int, input().split()))
rgb = []
for i in range(N + 1):
    for j in range(N - (i * R) + 1):
        key = i * R + j * G
        key = N - key
        if key % B == 0 and key / B >= 0:
            rgb.append([i, j, key // B])

#print(rgb)
print((len(rgb)))
# Original solution
r,g,b,n = list(map(int, input().split()))
ans = 0
for i in range(n // r + 1):
  res = n - r * i
  for j in range(res // g + 1): 
    res2 = res - g * j
    if res2 % 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):
  res = n - r * i
  for j in range(res // g + 1): 
    res2 = res - g * j
    if not (res2 % b):
      ans += 1
print(ans)
# Original solution
# AtCoder Grand Contest 033
# https://atcoder.jp/contests/agc033
import sys

s2nn = lambda s: [int(c) for c in s.split(' ')]
ss2nn = lambda ss: [int(s) for s in list(ss)]
ss2nnn = lambda ss: [s2nn(s) for s in list(ss)]
i2s = lambda: sys.stdin.readline().rstrip()
i2n = lambda: int(i2s())
i2nn = lambda: s2nn(i2s())
ii2ss = lambda n: [sys.stdin.readline() for _ in range(n)]
ii2nn = lambda n: ss2nn(ii2ss(n))
ii2nnn = lambda n: ss2nnn(ii2ss(n))



def main():
    R, G, B, N = i2nn()
    #a = []
    cnt = 0
    for r in range(N // R + 1):
        for g in range((N - R * r) // G + 1):
            #print([r, g, 0], N - R * r - G * g)
            if (N - R * r - G * g) % B == 0:
                cnt += 1
                #a.append([r,g,(N - R * r - G * g) // B])
    #print(a)
    print(cnt)
main()


# Optimized solution
import sys

s2nn = lambda s: [int(c) for c in s.split(' ')]
ss2nn = lambda ss: [int(s) for s in list(ss)]
ss2nnn = lambda ss: [s2nn(s) for s in list(ss)]
i2s = lambda: sys.stdin.readline().rstrip()
i2n = lambda: int(i2s())
i2nn = lambda: s2nn(i2s())
ii2ss = lambda n: [sys.stdin.readline() for _ in range(n)]
ii2nn = lambda n: ss2nn(ii2ss(n))
ii2nnn = lambda n: ss2nnn(ii2ss(n))



def main():
    R, G, B, N = i2nn()
    #a = []
    cnt = 0
    R, G, B = sorted((R, G, B), reverse=True)
    for r in range(N // R + 1):
        for g in range((N - R * r) // G + 1):
            #print([r, g, 0], N - R * r - G * g)
            if (N - R * r - G * g) % B == 0:
                cnt += 1
                #a.append([r,g,(N - R * r - G * g) // B])
    #print(a)
    print(cnt)
main()
# Original solution
R,G,B,N = list(map(int,input().split()))
cnt = 0

for x in range(N//R+1):
    for y in range(N//G+1):
        z = N - R*x - G*y
        if z >= 0 and z % B == 0:
            cnt += 1
print(cnt)

# Optimized solution
def main():
    R,G,B,N = list(map(int,input().split()))
    cnt = 0

    for x in range(N//R+1):
        for y in range(N//G+1):
            z = N - R*x - G*y
            if z >= 0 and z % B == 0:
                cnt += 1
    print(cnt)

if __name__ == "__main__":
    main()
# Original solution
R,G,B,N = list(map( int, input().split()))
count = 0
rmax = N//R
gmax = N//G
for r in range(rmax+1):
  tmp = r * R
  for g in range(gmax+1):
    tmp2 = tmp+g*G
    if N < tmp2:
      break
    if ((N - (tmp + g * G)) % B) == 0:
      count+=1
print(count)


# Optimized solution
R,G,B,N = list(map( int, input().split()))
count = 0
rmax = N//R
gmax = N//G
for r in range(rmax+1):
  tmp = r * R
  for g in range(gmax+1):
    tmp2 = N - (tmp+g*G)
    if tmp2 < 0:
      break
    if (tmp2 % B) == 0:
      count+=1
print(count)
# Original solution
R, G, B, N = list(map(int, input().split()))
count = 0
rgb = sorted([R, G, B], reverse=True)
for i in range(N+1):
    for j in range(N+1):
        tmp = N - (rgb[0] * i + rgb[1] * j)
        if 0 > tmp:
            break
        if tmp % rgb[2] == 0:
            count += 1

print(count)


# Optimized solution
R, G, B, N = list(map(int, input().split()))
count = 0
rgb = sorted([R, G, B], reverse=True)
if False:
    count = 0
else:
    for i in range(N+1):
        for j in range(N+1):
            tmp = N - (rgb[0] * i + rgb[1] * j)
            if 0 > tmp:
                break
            if tmp % rgb[2] == 0:
                count += 1
print(count)
# Original solution
r,g,b,n = list(map(int,input().split()))
counter = 0
sorts = sorted([r,g,b],reverse=True)
a = (n // sorts[0])+1
c = (n// sorts[1])+1

for i in range(a):
    for j in range(c):
        left = n - (sorts[0]*i) - (sorts[1]*j)
        if left >= 0 and   left % sorts[2] == 0:
            counter += 1
            
print(counter)

# Optimized solution
r,g,b,n = list(map(int,input().split()))
counter = 0
sorts = sorted([r,g,b],reverse=True)
a = (n // sorts[0])+1

for i in range(a):
    test = n
    test = test-(sorts[0]*i)
    c = (test//sorts[1])+1
    for j in range(c):
        left = test - (sorts[1]*j)
        if left >= 0 and   left % sorts[2] == 0:
            counter += 1
            
print(counter)
# Original solution
R,G,B,N = list(map(int, input().split()))
co = 0
for r in range(N//R+1):
    for g in range(N//G+1):
        tmp = N - r*R - g*G
        if (tmp >= 0) and (tmp%B == 0): 
            co += 1
print(co)

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

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

main()

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

    cnt = 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
            res = N - (r*R+g*G)
            if res % B == 0:
                cnt += 1
    print(cnt)

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

counter = 0
for r in range((N // R) + 1):
    for g in range(((N - (r * R)) // G) + 1):
        w_b_sum = N - ((R * r) + (G * g))

        if w_b_sum % B == 0 and w_b_sum >= 0 and w_b_sum == N - ((R * r) + (G * g)):
            # print(r, g, (w_b_sum // B))
            counter += 1
print(counter)


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

counter = 0
for r in range((N // R) + 1):
    for g in range(((N - (r * R)) // G) + 1):
        w_b_sum = N - ((R * r) + (G * g))

        if w_b_sum % B == 0 and w_b_sum >= 0:
            # print(r, g, (w_b_sum // B))
            counter += 1
print(counter)
# Original solution
import itertools
r,g,b,n=list(map(int,input().split()))
x,y=n//r,n//g
x,y=list(range(0,r*x+1,r)),list(range(0,g*y+1,g))
count=0
for i,j in list(itertools.product(x,y)):
  d=n-i-j
  if d<0:
    pass
  elif d==0:
    count+=1
  elif d%b==0:
    count+=1
print(count)

# Optimized solution
import collections
import itertools
r,g,b,n=list(map(int,input().split()))
x,y=n//r,n//g
x,y=list(range(0,r*x+1,r)),list(range(0,g*y+1,g))
l=[i+j for i,j in itertools.product(x,y) if i+j<=n]
z=collections.Counter(l)
count=0
for key,value in zip(list(z.keys()),list(z.values())):
  v=n-key
  if v==0:
    count+=value
  elif v%b==0:
    count+=value
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):
        bunshi=N-r*R-g*G
        q,m=divmod(bunshi,B)
        # if q<0:continue
        if m==0:cnt+=1            
print(cnt)

# Optimized solution
def main():
    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):
            bunshi=N-r*R-g*G
            q,m=divmod(bunshi,B)
            # if q<0:continue
            if m==0:cnt+=1
    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):
        temp = n-r*i-g*j
        if temp>=0 and temp%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
import sys
input = sys.stdin.readline

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

r = N // R
g = N // G
b = N // B

c = 0
for i in range(r + 1):
    for j in range(g + 1):
        t = N - i * R - j * G
        if t == 0:
            c += 1
            continue
            
        if t < 0:
            continue
            
        if t % B == 0:
            c += 1
                
print(c)

# Optimized solution
import sys
input = sys.stdin.readline

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

r = N // R

c = 0
for i in range(r + 1):
    p = N - i * R
    for j in range(int(p // G) + 1):
        t = p - j * G
        if t == 0:
            c += 1
            break
            
        if t % B == 0:
            c += 1
                
print(c)
# Original solution
R,G,B,N = (int(i) for i in input().split())


patterns = 0
for i in range(0,N+1,R):
    numredballs = i
    numothers = N - numredballs
    
    for j in range(0,numothers+1,G):
        numgreenballs = j
        numblueballs = numothers - numgreenballs
        
        if numblueballs % B != 0:
            continue
        else:
            numgreenboxes = numgreenballs % G
            numblueboxes = numblueballs % B
            patterns += 1

print(patterns)

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

patterns = 0
for i in range(0,N+1,R):
    numredballs = i
    numothers = N - numredballs
    
    for j in range(0,numothers+1,G):
        numgreenballs = j
        numblueballs = numothers - numgreenballs
        
        if numblueballs % B != 0:
            continue
        else:
            patterns += 1

print(patterns)
# Original solution
import sys

sys.setrecursionlimit(100000)

def f(a):
  global R,G,B,N,ans,Rm,Gm,Bm

  for b in range(N-R*a+1):
    cmod=(N-R*a-G*b)%B
    c=(N-R*a-G*b)//B
    if cmod==0 and  c>=0:
      ans+=1
    elif c<0:
      break

  if a>0:
    f(a-1)


R,G,B,N=list(map(int,input().split(" ")))
Rm=N//R
Gm=N//G
Bm=N//B

ans=0

f(Rm)

print(ans)

# Optimized solution
import sys

sys.setrecursionlimit(100000)

def f(a):
  global R,G,B,N,ans,Rm,Gm,Bm

  for b in range(N-R*a+1):
    cmod=(N-R*a-G*b)%B
    c=(N-R*a-G*b)//B
    if cmod==0 and  c>=0:
      ans+=1
    elif c<0:
      break

  if a>0:
    f(a-1)


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

ans=0

f(N//R+1)

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

#101


# 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):
                z=n-(i*r+j*g)
                if 0<=z and z%b==0:
                        #print(i,j,z)
                        cnt+=1
print(cnt)
# Original solution
colorn = list(map(int, input().split()))
color = colorn[0:3]
n = colorn[-1]
color.sort()

a, b, c = color[2], color[1], color[0]

a_max = n // a
cnt = 0

for i in range(a_max + 1):
    b_max = (n - a * i) // b
    for j in range(b_max + 1):
        c_max = (n - a * i - b * j) // c
        for k in range(c_max, c_max + 2):
            if a * i + b * j + c * k == n:
                cnt += 1
            elif a * i + b * j + c * k > n:
                break     
print(cnt)

# Optimized solution
colorn = list(map(int, input().split()))
color = colorn[0:3]
n = colorn[-1]
color.sort()

a, b, c = color[2], color[1], color[0]

a_max = n // a
cnt = 0
ip, jp, kp = -1, -1, -1

for i in range(a_max + 1):
    b_max = (n - a * i) // b
    d = n - a * i
    flag = 0
    for j in range(b_max + 1):
        c_max = (n - a * i - b * j) // c
        for k in range(c_max, c_max + 2):
            if a * i + b * j + c * k == n:
                cnt += 1
                if ip == i:
                    dj = j - jp
                    cnt += ((d // b - j) // dj)
                    flag = 1
                    break
                else:
                    ip, jp, kp = i, j, k
            elif a * i + b * j + c * k > n:
                break
        if flag == 1:
            break
print(cnt)
# Original solution
R, G, B ,N = list(map(int, input().split(' ')))

cnt = 0

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

_i = N//li[2]

for i in range(_i+1):
    _j = (N - li[2]*i)//li[1] 
    for j in range(_j+1):
        _k = (N - li[2]*i - li[1]*j)//li[0]
        for k in range(_k, _k+1):
            if i*li[2] + j*li[1] + k*li[0] == N:
                cnt += 1
print(cnt)

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

cnt = 0

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

_i = N//li[2]
for i in range(_i+1):
    _j = (N - li[2]*i )//li[1]
    for j in range(_j + 1):
        if (N - i*li[2] -  j*li[1])%li[0] == 0:
            cnt += 1

print(cnt)
# 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 :
            break
        b = (N - r * R - g * G) / B
        if b >= 0 and b.is_integer() :
            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):
    if r > N :
        break
    for g in range(r, N + 1, G) :
        if g > N :
            break
        b = (N - g) / B
        if b >= 0 and b.is_integer() :
            ans += 1
print(ans)
# Original solution
import math
r,g,b,n = [int(u) for u in input().split(" ")]
i = 0
for ir in range(math.floor(n/r)+1):
  if ir*r>n:
    break
  for ig in range(math.floor(n/g)+1):
    y = n - (ir*r+ig*g)
    if y<0:
      break
    if y>=0 and y%b==0:
      #print(ir,ig,y/b)
      i+=1
      continue
print(i)

# Optimized solution
import math
r,g,b,n = [int(u) for u in input().split(" ")]
i = 0
for ir in range(math.floor(n/r)+1):
  if ir*r==n:
    i+=1
    break
  elif ir*r>n:
    break
  for ig in range(math.floor(n/g)+1):
    y = n - (ir*r+ig*g)
    if y<0:
      break
    if y%b==0:
      #print(ir,ig,y/b)
      i+=1
      continue
print(i)
# Original solution
r, g, b, n = list(map(int, input().split()))
ans = 0

l = [r, g, b]
l.sort(reverse=True)
for i in range(n+1):
    if l[0]*i > n:
        break
    for j in range(n+1):
        if l[0]*i + l[1]*j > n:
            break
        elif (n-(l[0]*i + l[1]*j)) % l[2] == 0:
            ans += 1
print(ans)

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

l = [r, g, b]
l.sort(reverse=True)
a = n // l[0]
for i in range(a+1):
    for j in range(n+1):
        if l[0]*i + l[1]*j > n:
            break
        elif (n-(l[0]*i + l[1]*j)) % l[2] == 0:
            ans += 1
print(ans)
# Original solution
r, g, b, n = list(map(int, input().split()))
s_rgb = sorted([r, g, b], reverse=True)
result = 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]:
        if s_rgb[0] * i + s_rgb[1] * j > n:
            break
        for k in range(int((n - s_rgb[0] * i - s_rgb[1] * j) / s_rgb[2]) + 1)[::-1]:
            if s_rgb[0] * i + s_rgb[1] * j + s_rgb[2] * k > n:
                break
            if s_rgb[0] * i + s_rgb[1] * j + s_rgb[2] * k == n:
                result += 1
                break
print(result)


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