CodeEff/ECCO huggingface dataset:
# Original solution
r,g,y,n=list(map(int,input().split()))
a=0
b=0
c=0
count=0


m=n
for i in range((n//r)+1):
    a=i
    m=m-r*i
    for j in range((n//g)+1):
        b=j
        c=m-j*g
        if c%y==0 and c>=0 :
            count+=1

    m=n

print(count)



# Optimized solution
r,g,y,n=list(map(int,input().split()))
a=0
b=0
c=0
count=0


m=n
for i in range((n//r)+1):
    m=m-r*i
    for j in range((m//g)+1):
        c=m-j*g
        if c%y==0 and c>=0 :
            count+=1

    m=n

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

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

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

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

print(ans)

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

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

solve()

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

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

solve()

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

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

l.reverse()
r_max=N//l[0]
g_max=N//l[1]
RR=l[0]
GG=l[1]
BB=l[2]
ans=0
for r in range(r_max+1):
    res=N-r*RR
    for g in range(g_max+1):
        x=res-GG*g
        if x>=0 and x%BB==0:
            ans+=1
            
print(ans)

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

l.reverse()
r_max=N//l[0]
g_max=N//l[1]
RR=l[0]
GG=l[1]
BB=l[2]
ans=0
for r in range(r_max+1):
    res=N-r*RR
    for g in range(g_max+1):
        x=res-GG*g
        if x<0:
            break
        if x%BB==0:
            ans+=1
            
print(ans)
# 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):
        rg = i * r + j * g
        rest = n - rg
        if rest < 0:
            continue
        elif rest == 0:
            count += 1
        elif rest % b == 0:
            count += 1

print(count)

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

count = 0
a = n // r
t = n // g

for i in range(a+1):
    for j in range(t+1):
        rg = i * r + j * g
        rest = n - rg
        if rest < 0:
            continue
        elif rest % b == 0:
            count += 1

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

R,G,B = reversed([R,G,B])
r = 0
count = 0
r_max = N // R

while r <= r_max:
    
    g_max = (N-r*R)//G
    g = 0
    while g <= g_max:
        b = (N-r*R-g*G)/B
        if b.is_integer() and b >= 0:
            count += 1

        g += 1
    
    r += 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(r,N+1,G):
        b = (N-g)/B
        if b.is_integer() and b >= 0:
            count += 1

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

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

# 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=list(map(int,input().split()))
ans=0

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

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

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

print(ans)

# Optimized solution
def main():

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

    ans = 0

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

    print(ans)

if __name__=='__main__':
    main()
# Original solution
from collections import defaultdict, deque, Counter
def inpl(): return list(map(int, input().split()))

R, G, B, N = inpl()
ans = 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):
            ans += 1
print(ans)

# Optimized solution
from collections import defaultdict, deque, Counter
def inpl(): return list(map(int, input().split()))

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

res = 0

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

print(res)


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

res = 0

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

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

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

ans = 0
for r in range(N // R + 1):
    if N - r * R < 0:
        break
    for g in range((N - R * r) // G + 1):
        tmp = N - r * R - g * G
        if tmp < 0:
            break
        if tmp % B == 0 and 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):
        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()))
c = 0
for r in range(0, N+1):
  for g in range(0, N+1):
    n = N-r*R-g*G
    if n < 0:
      continue
    if n%B == 0:
      c += 1
print(c)


# Optimized solution
R, G, B, N = list(map(int, input().split()))
R, G, B = sorted([R, G, B], reverse=True)
if B == 1:
  c = 0
  for r in range(0, N+1):
    if r*R > N:
      break
    n = N-r*R
    c += 1+n//G
  print(c)
  exit()
c = 0
for r in range(0, N+1):
  if r*R > N:
    break
  for g in range(0, N+1):
    if r*R+g*G > N:
      break
    n = N-r*R-g*G
    if n%B == 0:
      c += 1
print(c)
# Original solution
R,G,B,N = list(map(int,input().split()))
r = N//R
g = N//G
ans = 0

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

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

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

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

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

cnt = 0
NR = N//R
NG = N//G
for r in range(NR + 1):
  for g in range(NG + 1):
    NrRgG = N - (r*R + g*G)
    if NrRgG < 0:
      break
    elif NrRgG >= 0:
      if NrRgG % B == 0:
        cnt += 1
print(cnt)

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

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

R = RGB[0]
G = RGB[1]
B = RGB[2]

cnt = 0
NR = N//R
NG = N//G
for r in range(NR + 1):
  for g in range(NG + 1):
    NrRgG = N - (r*R + g*G)
    if NrRgG < 0:
      break
    elif NrRgG >= 0:
      if NrRgG % 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//G + 1):
    if (N - (r*R + g*G)) % B == 0 and  (N - (r*R + g*G)) >= 0:
      cnt += 1
print(cnt)


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

# Optimized solution
R, G, B, N = list(map(int, input().split()))
R, G, B = sorted([R, G, B], reverse=True)
ret = 0
for r in range(N//R+1):
    if G == 1:
        ret += N-r+1
    else:
        for g in range((N-r)//G+1):
            if N - (R*r+G*g) >= 0:
                if (N - (R*r+G*g)) % B == 0:
                    ret += 1
print(ret)
# Original solution
def main():
    r,g,b,n = list(map(int, input().split()))
    tmp = [r,g,b]
    r,g,b = sorted(tmp, reverse=True)
    res = 0
    for i in range(n//r + 1):
        for j in range(n//g + 1):
            if r*i + g*j <= n:
                if (n-(r*i + g*j)) % b==0:
                    res += 1           
    print(res)

if __name__ == '__main__':
    main()


# Optimized solution
def main():
    r,g,b,n = list(map(int, input().split()))
    tmp = [r,g,b]
    r,g,b = sorted(tmp, reverse=True)
    res = 0
    for i in range(n//r + 1):
        if i*r > n:
            break
        for j in range(n//g + 1):
            if r*i + g*j > n:
                break
            if (n-(r*i + g*j)) % b==0:
                res += 1           
    print(res)

if __name__ == '__main__':
    main()
# 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):
        a = n - r*i - g*j
        if a >= 0 and a % b == 0:
            cnt += 1

print(cnt)

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

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

count = 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 (n - i*r - j*g) >= 0:
            count += 1

# for i in range(0, n+1):
#     for j in range(0, n+1):
#         for k in range(0, n+1):
#             if r*i + g*j + b*k == n:
#                 count += 1


print(count)


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

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

count = 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:
            count += 1

# やってはいけないやつ
# for i in range(0, n+1):
#     for j in range(0, n+1):
#         for k in range(0, n+1):
#             if r*i + g*j + b*k == n:
#                 count += 1

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

result = 0

max_r = n // r

for i in range(max_r + 1):
    max_g = (n - i * r) // g + 1
    for j in range(max_g):
        if i * r + j * g > n:
                continue
        if (n - i * r - j * g ) % b == 0:
            result += 1
print(result)

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

result = 0
max_r = n // r

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

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

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

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

if __name__ == "__main__":
    main()
# Original solution
def main():
    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):
            
            res = (N - (R*r + G*g)) 
            if res >= 0 and res % B == 0:
                ans += 1

    print(ans)

if __name__ == "__main__":
    main()

# Optimized solution
def main():
    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):

            res = (N - (R*r + G*g)) 

            if res < 0 :
                break

            if res >= 0 and res % B == 0:
                ans += 1

    print(ans)

if __name__ == "__main__":
    main()
# Original solution
import sys

input = sys.stdin.readline
r, g, b, n = list(map(int, input().split()))
cnt = 0
for i in range(int(n/r)+1):
    for j in range(int(n/g)+1):
        tmp = r*i + g*j
        if tmp > n:
            break
        else:
            tmp = n - tmp 
        if tmp%b == 0:
            cnt += 1
print(cnt)


# Optimized solution
r, g, b, n = list(map(int, input().split()))
cnt = 0
for i in range(0, n+1, r):
    for j in range(0, n+1, g):
        tmp = n - (i+j)
        if tmp < 0:
            break
        if tmp%b == 0:
            cnt += 1
print(cnt)
# Original solution
r,g,b,n=list(map(int,input().split()))

sum=0
for x in range(0,1+(3000//r)):
    for y in range(0,1+(3000-x*r)//g):
        if r*x+g*y<=n and (n-r*x-g*y)%b==0:
            sum+=1
print(sum)

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

sum=0
for x in range(0,1+(n//r)):
    for y in range(0,1+(n-x*r)//g):
        if (n-r*x-g*y)%b==0:
            sum+=1
print(sum)
# Original solution
r,g,b,n = list(map(int,input().split(" ")))
count = 0
for i in range(n+1):
    for j in range(n+1):
        if (i * r + j * g) <= n:
            if (n - (i * r + j * g)) % 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):
    for j in range(0,n+1,g):
        if i + j <= n:
            if (n - (i + j)) % b == 0: 
                    count += 1
print(count)
# Original solution
from sys import stdin
import math
input=input=stdin.readline().rstrip().split()
for i in range(len(input)):
  input[i]=int(input[i])

output=0
R=input[0]
G=input[1]
B=input[2]
N=input[3]
for r in range(math.floor(N/R)+1):
    for g in range(math.floor(N/G)+1):
        #for b in range(math.floor(N/B)+1):
        #print(r,g)
        #if r*R+g*G+b*B==N:
        b=N-(r*R+g*G)
        #b/B
        if b>=0:
            if b % B == 0:
                #print(r,g)
                output+=1
print(output)

# Optimized solution
from sys import stdin
import math
input=input=stdin.readline().rstrip().split()
for i in range(len(input)):
  input[i]=int(input[i])

output=0
R=input[0]
G=input[1]
B=input[2]
N=input[3]
for r in range(math.floor(N/R)+1):
    for g in range(math.floor(N/G)+1):
        #for b in range(math.floor(N/B)+1):
        #print(r,g)
        #if r*R+g*G+b*B==N:
        b=N-(r*R+g*G)
        #b/B
        #if b>=0:
        if b<0:
            break
        if b % B == 0:
            #print(r,g)
            output+=1
print(output)
# Original solution
R, G, B, N = list(map(int, input().split()))

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

print(score)

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

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

print(score)
# Original 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):
    b = (N-R*r-G*g)/B
    if b.is_integer() and b >= 0:
      count += 1
print(count)



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

cnt = 0

for i in range(rmax+1):
    for j in range(gmax+1):
        if R*i + G*j > N:
            continue
        if ((N-R*i-G*j)%B == 0) and ((N-R*i-G*j)//B <= bmax):
            cnt += 1
print(cnt)

# Optimized solution
R,G,B,N = list(map(int,input().split()))
A = [R,G,B]
A.sort()
R = A[2]
G = A[1]
B = A[0]
rmax = N//R
gmax = N//G
bmax = N//B

cnt = 0

if R == 1:
    print(((N+1)*(N+2)//2))
    exit()

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

# Optimized solution
r,g,b,n=list(map(int,input().split()))
m=[r,g,b]
m.sort(reverse=1)
r,g,b=m[0],m[1],m[2]
ans=0
if m==[1,1,1]:
  print(((n+2)*(n+1)//2))
else:
  for i in range(n+1):
    if r*i>n:
      break
    for j in range(n+1):
      if r*i+g*j>n:
        break
      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(N//R+1):
    for g in range((N-r*R)//G+1):
        tmp = (N-r*R-g*G)/B
        if tmp.is_integer():
            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()))
total = 0
ref = 0
count = 0
for i in range(n//r+1):
        for j in range((n-r*i)//g+1):
                total = r*i + g*j
                ref = n - total
                if (ref >= 0):
                        if ref%b == 0:
                                count += 1
print(count)

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