Problem:
 Score : 200 points    Problem Statement Snuke has come to a store that sells boxes containing balls. The store sells the following three kinds of boxes:   Red boxes, each containing R red balls  Green boxes, each containing G green balls  Blue boxes, each containing B blue balls   Snuke wants to get a total of exactly N balls by buying r red boxes, g green boxes and b blue boxes.
How many triples of non-negative integers (r,g,b) achieve this?      Constraints  All values in input are integers.  1 \leq R,G,B,N \leq 3000         Input Input is given from Standard Input in the following format:  R  G  B  N       Output Print the answer.        Sample Input 1 1 2 3 4      Sample Output 1 4  Four triples achieve the objective, as follows:   (4,0,0)  (2,1,0)  (1,0,1)  (0,2,0)        Sample Input 2 13 1 4 3000      Sample Output 2 87058

Solution (Python):
R,G,B,N = (int(x) for x in input().split())
maxr = N // R
maxg = N // G
count = 0
for i in range(maxr+1):
    for j in range(maxg+1):
        checker = N - (i*R + j*G)
        if checker // B >= 0:
            if checker % B == 0:
                count += 1
        elif checker == 0:
            count += 1
print(count)

Solution (Python):
a, b, c, n = list(map(int, input().split()))

cnt = 0
for i in range(n//a+1):
  an = n - a * i
  if an >= 0:
    for j in range(an//b+1):
      num = an - b * j
      if num >= 0 and num % c == 0:
        cnt+=1
        
print(cnt)

Solution (Python):
a, b, c, n = list(map(int, input().split()))

cnt = 0
for i in range(n//a+1):
  an = n - a * i
  for j in range(an//b+1):
    num = an - b * j
    if num >= 0 and num % c == 0:
      cnt+=1
        
print(cnt)

Solution (Python):
import math
R, G, B, N = 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)

Solution (Python):
r,g,b,n=map(int,input().split())

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

Solution (Python):
import sys
def input(): return sys.stdin.readline().rstrip()
def main():
    R,G,B,n=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)


if __name__=='__main__':
    main()

Solution (Python):
R,G,B,N=map(int,input().split())

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

print(ans)

Solution (Python):
import sys
def input(): return sys.stdin.readline().rstrip()
def main():
    R,G,B,n=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)


if __name__=='__main__':
    main()

Solution (Python):
r, g, b, n = map(int, input().split())

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

Solution (Python):
R, G, B, N = map(int, input().split())
R_max = N // R + 1
G_max = N // G + 1
B_max = N // B + 1
ans = 0
for i in range(0, R_max):
    for j in range(0, G_max):
        
            
        
        if (N - (i * R + j * G)) % B == 0 and (N - (i * R + j * G)) >= 0:
            
            ans += 1
print(ans)

Solution (Python):
R, G, B, N = map(int, input().split())
def solve():
    ans = 0
    for i in range(N//R+1):
        b1 = N - i*R
        for j in range(b1//G+1):
            b2 = b1 - j*G
            if b2%B==0:
                ans += 1
    return ans
print(solve())

Solution (Python):
R, G, B, N = map(int, input().split())
def solve():
    ans = 0
    for i in range(N//R+1):
        b1 = N - i*R
        for j in range(b1//G+1):
            b2 = b1 - j*G
            if b2%B==0:
                ans += 1
    return ans
print(solve())

Solution (Python):

import sys

read = sys.stdin.buffer.read

readlines = sys.stdin.buffer.readlines
a, b, c, n = map(int, input().split())
ans = 0
for i in range(3001):
    for j in range(3001):
        if n >= i * a + j * b and (n - i * a - j * b) % c == 0:
            ans += 1
print(ans)

Solution (Python):
r,g,b,n = map(int,input().split(' '))
A = [r,g,b]
A.sort()
r,g,b = A[2], A[1], A[0]
rmax, gmax = n//r, n//g
count = 0
i = 0
while i <= rmax:
    j = 0
    if g == 1:
        count += (n-i*r)+1
        j += 30000
    while (n-i*r-j*g) >= 0:
        if (n-i*r-j*g)%b == 0:
            count += 1
        j += 1
    i += 1
print(count)

Solution (Python):


r , g , b , n = map(int,input().split())
ans = 0
R = -(-n//r)
G = -(-n//g)
for i in range(R+1):
    for j in range(G+1):
        su = n-r*i-g*j
        if n-r*i-g*j < 0:
            break
        else:
            if (su/b).is_integer():
                ans += 1
print(ans)

Solution (Python):
import sys
input = sys.stdin.readline


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

for r in range(N + 1):
	for g in range(N + 1):
		b_sum = N - R*r - G*g
		
		if b_sum < 0:
			break
		else:
			if (b_sum / B).is_integer():
				ans += 1

print(ans)

Solution (Python):
def resolve():
    r, g, b, n = map(int, input().split())
    ans = 0
    for i in range((n//r)+1):
        for j in range(((n-(r*i))//g)+1):
            if (n-(i*r + j*g)) % b == 0:
                ans += 1
    print(ans)
resolve()

Solution (Python):
R,G,B,N=map(int,input().split())
ans=0
for i in range(N//R+1):
    zan=N-R*i
    if zan==0:
        ans+=1
        continue
    for j in range(N//G+1):
        zan2=zan-G*j
        if zan2<0:
            break
        if zan2%B==0:
            ans+=1
print(ans)

Solution (Python):
R, G, B, N=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)

Solution (Python):
r,g,b,n=map(int,input().split())
ans=0
for i in range(n//r+1):
    if r*i==n:
        ans+=1
        break
    else:
        for j in range((n-r*i)//g+1):
            if r*i+g*j==n:
                ans+=1
                continue
            else:
                if n-(r*i+g*j)>0 and (n-(r*i+g*j))%b==0:
                    ans+=1

print(ans)

Solution (Python):
R,G,B,N=map(int, input().split())
rmax=N//R
gmax=N//G
ans=0
for r in range(rmax+1):
  for g in range(gmax+1):
    if N-(r*R+g*G)>=0 and (N-(r*R+g*G))%B==0:
      ans+=1
print(ans)

Solution (Python):
r,g,b,n = map(int,input().split())
l = [r,g,b]
l.sort()
count = 0
for i in range(n//l[2]+1):
    for j in range((n-l[2]*i)//l[1]+1):
        if (n-i*l[2]-j*l[1])%l[0] == 0:
            count += 1
print(count)

Solution (Python):
r,g,b,n=map(int,input().split())

ans=0
for x in range(3001):
    for y in range(3001):
        if (n-r*x-g*y)>=0 and (n-r*x-g*y)%b==0:
            ans+=1
print(ans)

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

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

Solution (Python):
R,G,B,N = map(int,input().split())
count = 0
for r in range(3001):
    if N-r*R<0:
        break
    for g in range(3001):
        if N-(r*R+g*G)>=0 and (N-(r*R+g*G))%B==0:
            count += 1
print(count)

Solution (Python):
r, g, b, n = map(int, input().split())

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

Solution (Python):
R, G, B, N = map(int, input().split())

ans = 0
for r in range(N + 1):
    for g in range(N + 1):
        ball = N - r * R - g * G
        check = (ball / B)
        if check.is_integer() and check >= 0:
            ans += 1
print(ans)

Solution (Python):
R, G, B, N = 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)

Solution (Python):
r, g, b, n = 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)

Solution (Python):
R,G,B,n=map(int, input().split())
ans=0

for r in range(n+1):
    if r%R==0:
        for g in range(n+1-r):
            b = n-r-g
            if b%B==0 and r%R==0 and g%G==0:
                ans+=1

print(ans)

Solution (Python):
r,g,b,n = map(int, input().split())

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

Solution (Python):
R,G,B,N=map(int,input().split())
cnt=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:
      cnt+=1
print(cnt)

Solution (Python):
R, G, B, N = map(int, input().split())
ctr = 0


for r in range(N + 1):
    for g in range(N + 1 - r):
        b = N - r - g
        if r % R == 0 and g % G == 0 and b % B == 0:
            ctr += 1

print(ctr)

Solution (Python):
R,G,B,N=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
        if b < 0 or b%B: continue
        ans += 1
print(ans)

Solution (Python):
r,g,b,n = map(int,input().split())
cnt = 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:
            cnt += 1
print(cnt)

Solution (Python):
r, g, b, n = map(int, input().split())

ans = 0
for i in range(n+1):
    for j in range(n+1):
        s = n - r*i - g*j
        if s < 0:
            continue
        else:
            if s%b == 0:
                ans += 1
print(ans)

Solution (Python):
def main():
    R, G, B, N = (int(i) for i in input().split())
    ans = 0
    for r in range(N+1):
        for g in range(N+1):
            need = N - r*R - g*G  
            if need < 0:
                continue
            b = 0--need//B
            if r*R + g*G + b*B == N:
                ans += 1
                
    print(ans)


if __name__ == '__main__':
    main()

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

Solution (Python):
r, g, b, n = map(int, input().split())
cnt = 0
for i in range(n+1):
    for j in range(n+1):
        if n-i*r-j*g >= 0 and (n-i*r-j*g) % b == 0:
            cnt += 1
print(cnt)

Solution (Python):
import sys

def solve():
    input = sys.stdin.readline
    R, G, B, N = map(int, input().split())
    count = 0
    for i in range(N // R + 1):
        red = R * i
        lem = N - red
        for j in range(lem // G + 1):
            green = G * j
            if (lem - green) % B == 0: count += 1
    print(count)

    return 0

if __name__ == "__main__":
    solve()

Solution (Python):
r,g,b,n = map(int, input().split())
ans = 0
for i in range(3001):
    for j in range(3001):
        a = (n - r*i - g*j)/b
        if a == int(a) and a >= 0:
            ans += 1
print(ans)

Solution (Python):
R,G,B,N = map(int,input().split())
ans = 0
for r in range(N+1):
    if r*R > N: break
    for g in range(N+1):
        if r*R + g*G > N: break
        rem = N - r*R - g*G
        if rem%B == 0:
            ans += 1
print(ans)

Solution (Python):
R, G, B, N = map(int, input().split())

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

print(ans)

Solution (Python):
def solve():
    r,g,b,n = map(int,input().split())
    ans = 0
    for i in range(n+1):
        if r*i>n:
            break
        for j in range(n+1):
            if g*j+r*i>n:
                break
            if (n-g*j-r*i)%b==0:
                ans+=1
    print(ans)
if __name__=='__main__':
    solve()

Solution (Python):
r,g,b,n = map(int,input().split())
count = 0
for i in range(n+1):
    for j in range(n+1):
        all_sum = n
        all_sum  -= i*r
        all_sum  -= j*g
        if all_sum < 0:
            continue
        if all_sum %b == 0 and i+j+(all_sum//b) != 0:
            count += 1
            
print(count)

Solution (Python):
r,g,b,n=map(int,input().split())
R=n//r
ans=0
for i in range(R+1):
  for j in range(((n-i*r)//g)+1):
    if ((n-i*r-j*g)/b).is_integer():
      ans+=1
print(ans)

Solution (Python):
r,g,b,n=map(int,input().split())
R=n//r
ans=0
for i in range(R+1):
  for j in range(((n-i*r)//g)+2):
    if 0<=n-i*r-j*g and (n-i*r-j*g)%b==0:
      ans+=1
print(ans)

Solution (Python):
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

r, g, b, n = map(int, read().split())
cnt = 0
for i in range(n // r + 1):
    for j in range(n // g + 1):
        check = n - (r * i + g * j)
        if check >= 0:
            if check % b == 0:
                cnt += 1
        else:
            break
print(cnt)

Solution (Python):
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

r, g, b, n = map(int, read().split())
cnt = 0
for i in range(n + 1):
    for j in range(n + 1):
        check = n - (r * i + g * j)
        if check >= 0:
            if check % b == 0:
                cnt += 1
        else:
            break
print(cnt)

Solution (Python):
R,G,B,N = 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).is_integer():
            ans += 1

print(ans)

Solution (Python):
r,g,b,n=map(int,input().split())
ans=0
for x in range(n//r+1):
    for y in range((n-x*r)//g+1):
        if (n-x*r-y*g)%b==0:
            ans+=1
print(ans)

Solution (Python):
r0,g0,b0,n=map(int,input().split())
ans=0
l=[r0,g0,b0]
l.sort(reverse=True)
r=l[0]
g=l[1]
b=l[2]
x=0
while x*r<=n:
    y=0
    if g==1:
        ans+=1+n-x*r
        x+=1
        continue
    if b==1:
        ans+=1+(n-x*r)//g
        x+=1
        continue
    while y*g<=n-x*r:
        if (n-x*r-y*g) % b == 0:
            ans+=1
        y+=1
    x+=1
print(ans)

Solution (Python):
r,g,b,n = [int(x) for x in input().split()]

ans = 0

for x in range(n//r + 1):
    for y in range(n // g + 1):
        if (n - (r * x + g * y)) % b == 0 and (n - (r*x + g*y)) >= 0:
            ans += 1
print(ans)

Solution (Python):
R, G, B, N = map(int, input().split())

ans = 0
r = 0
g = 0
while r * R <= N:
    g = 0
    while r * R + g * G <= N:
        diff = N - (r * R + g * G)
        if diff % B == 0:
            ans += 1
        g += 1
    r += 1

print(ans)

Solution (Python):
import math
r,g,b,n = map(int,input().split())

max_r, max_g = math.floor(n/r),math.floor(n/g)

c = 0
for i in range(max_r+1):
    for j in range(max_g+1):
        b_n = n - (i*r) - (j*g)
        if b_n < 0:
            continue
        if b_n % b == 0:
            c += 1

print(c)

Solution (Python):
import sys
sys.setrecursionlimit(10 ** 5 + 10)
def input(): return sys.stdin.readline().strip()

def resolve():
    R,G,B,N=map(int,input().split())
    cnt=0
    for r in range(N+1):
        for g in range(N+1):
            val=(N-R*r-G*g)/B
            if val==int(val) and val>=0:
                cnt+=1
    print(cnt)

resolve()

Solution (Python):
r, g, b, n = map(int,input().split())

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

print(ans)

Solution (Python):
R, G, B, N = 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)

Solution (Python):
R, G, B, N = 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)

Solution (Python):
R, G, B, N = 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)

Solution (Python):
R, G, B, N = map(int, input().split())

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

Solution (Python):
R, G, B, N = 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)

Solution (Python):
R,G,B,N = map(int,input().split())
count= 0
sum = 0

for i in range(N//R +1):
    sum = 0
    sum += i * R
    for j in range((N-sum) // G +1):
        Ssum = sum
        Ssum += j * G
        if (N - Ssum) % B == 0:
            count += 1

print(count)

Solution (Python):
r,g,b,n=map(int,input().split())
a=0
for i in range(3001):
    for j in range(3001):
        if (n-(r*i+g*j))%b==0 and (n-(r*i+g*j))>=0:
            a+=1
print(a)

Solution (Python):
a,b,c,n = map(int,input().split())
ans = 0
for i in range(0,3001):
  for j in range(0,3001):
    dum1,dum2 = divmod((n-(a*i+b*j)),c)
    if dum2 == 0 and dum1 >= 0:
      ans += 1
print(ans)

Solution (Python):
R,G,B,N = list(map(int, input().split()))
count = 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:
            count += 1

print(count)

Solution (Python):
R,G,B,N = map(int,input().split())
ans = 0
for i in range(0,N//R+1):
    for j in range(0,(N - R*i)//G+1):
        k = N - R*i - G*j
        if k%B == 0:
            ans += 1
print(ans)

Solution (Python):
import sys
input=sys.stdin.readline

def main():
    r,g,b,n=map(int,input().split())
    ans=0
    for i in range(n+1):
        for j in range(n+1):
            B=i*r+j*g
            if B>n: continue
            if (n-B)%b==0:
                ans+=1
    print(ans)

if __name__=="__main__":
    main()

Solution (Python):
R, G, B, N = map(int, input().split())

res = 0
for i in range(N+1):
  count = R*i
  if N < count:
    break
  for j in range(N+1):
    count = R*i + G*j
    if N < count:
      break
    else:
      if (N - count) % B == 0:
        res += 1

print(res)

Solution (Python):
from sys import stdin

r, g, b, n = map(int, stdin.readline().rstrip().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)

Solution (Python):
r, g, b, n = map(int, input().split())
cnt = 0
for i in range(n+1):
    for j in range(n+1):
        v = r*i + g*j
        if n>=v and (n-v)%b==0: cnt+=1
print(cnt)

Solution (Python):
a, b, c, n = map(int,input().split())
ans = 0
for i in range(n+1):
    for j in range(n+1):
        d = n - a*i - b*j
        if d >= 0 and d % c == 0:
            ans += 1
print(ans)

Solution (Python):
from sys import stdin
input = stdin.readline

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

ans = 0

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

print(ans)

Solution (Python):
def main():
    R,G,B,N = map(int,input().split())
    
    count = 0
    for i in range(N//R+1):
        r = N-R*i
        for j in range(r//G+1):
            rr = r-G*j
            if rr%B == 0:
                count += 1
    
    print(count)
    
if __name__ == "__main__":
    main()

Solution (Python):
R,G,B,N=map(int,input().split())
ans=0

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

print(ans)

Solution (Python):
cnt = 0
R, G, B, N = map(int, input().split())
comb = []
tmp = []
rgb = [R, G, B]

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

print(cnt)

Solution (Python):
r,g,b,n=map(int,input().split())
cnt=0
for i in range(n+1):
    for j in range(n-i+1):
        k=n-(i+j)
        if k>=0 and i%r==j%g==k%b==0:
            cnt+=1
print(cnt)

Solution (Python):
r,g,b,n=map(int,input().split())
def INT(m):
  if int(m)==m:
    return True
  return False
aa=[r,g,b]
aa.sort()
a,b,c=aa[0],aa[1],aa[2]
ans=0
for i in range(n//c +1):
  for j in range((n-i*c)//b +1):
    if INT((n-i*c-j*b)/a):
      ans+=1
print(ans)

Solution (Python):
r, g, b, n = map(int, input().split())

cnt = 0
for ri in range(3000 // r + 1):
    left1 = n - ri * r
    for bi in range(left1 // b + 1):
        left2 = left1 - bi * b
        if left2 >= 0 and left2 % g == 0:
            cnt += 1

print(cnt)

Solution (Python):
import sys
sys.setrecursionlimit(10**6)
from math import floor,ceil,sqrt,factorial,log
from heapq import heappop, heappush, heappushpop
from collections import Counter,defaultdict,deque
from itertools import accumulate,permutations,combinations,product,combinations_with_replacement
from bisect import bisect_left,bisect_right
from copy import deepcopy
from operator import itemgetter
from fractions import gcd
mod = 10 ** 9 + 7
inf = float('inf')
ninf = -float('inf')
 

def ii(): return int(sys.stdin.readline().rstrip()) 
def mii(): return map(int,sys.stdin.readline().rstrip().split())
def limii(): return list(mii()) 
def lin(n:int): return [ii() for _ in range(n)]
def llint(n: int): return [limii() for _ in range(n)]

def ss(): return sys.stdin.readline().rstrip() 
def mss(): return sys.stdin.readline().rstrip().split()
def limss(): return list(mss()) 
def lst(n:int): return [ss() for _ in range(n)]
def llstr(n: int): return [limss() for _ in range(n)]





r,g,b,n=mii()
arr=sorted([r,g,b])

gg=n//arr[1] +1
bb=n//arr[2] +1
ans=0



for i in range(gg):
    for j in range(bb):
        if (n-(arr[1]*i+arr[2]*j))%arr[0]==0 and (n-(arr[1]*i+arr[2]*j))>=0:
            ans+=1


print(ans)

Solution (Python):
r, g, b, n = map(int, input().split())

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

print(ans)

Solution (Python):

from collections import defaultdict,deque
from heapq import heappush, heappop
from bisect import bisect_left, bisect_right
import sys, random, itertools, math
sys.setrecursionlimit(10**5)
input = sys.stdin.readline
sqrt = math.sqrt
def LI(): return list(map(int, input().split()))
def LF(): return list(map(float, input().split()))
def LI_(): return list(map(lambda x: int(x)-1, input().split()))
def II(): return int(input())
def IF(): return float(input())
def S(): return input().rstrip()
def LS(): return S().split()
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007
inf = 1e10


def solve():
    R, G, B, n = LI()
    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 r * R + g * G + b * B == n:
                
                ans += 1
    print(ans)
    return



if __name__ == '__main__':
    solve()

Solution (Python):

def inputlist(): return [int(j) for j in input().split()]
from collections import Counter


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

Solution (Python):
R, G, B, N = 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)

Solution (Python):
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()

Solution (Python):
r, g, b, n = map(int, input().split())

max_ = n // min(r, g, b)
t = 0
for i in range(max_+1):
    for j in range(max_ + 1):
        if (n - r * i - g * j) % b == 0 and n >= r * i + g * j:
            t += 1
print(t)

Solution (Python):
R, G, B, N = map(int, input().split())

ans = 0

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

print(ans)

Solution (Python):
R, G, B, N = map(int, input().split())

ans = 0
for i in range(N // R + 1):
  for j in range((N - i * R) // G + 1):
    ball = i * R + j * G
    if N == ball:
      ans += 1
    elif (N - ball) % B == 0:
      ans += 1

print(ans)

Solution (Python):
R, G, B, N = 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 >= 0 and b.is_integer():
            ans += 1
print(ans)

Solution (Python):
def main():
    red_box, green_box, blue_box, target = map(int, input().split())
    answer = 0
    for i in range(target // red_box + 1):
        for j in range(target // green_box + 1):
            now_balls = red_box * i + green_box * j
            if (target - now_balls) % blue_box == 0 and target >= now_balls:
                answer += 1
            elif target < now_balls:
                break
    print(answer)


if __name__ == '__main__':
    main()

Solution (Python):
r,g,b,n = map(int,input().split())
ans = 0
x=n//r+1
y=n//g+1
for i in range(x):
    for j in range(y):
        if r*i+g*j > n:
            break
        if (n-r*i-g*j)%b == 0:
            ans+=1
print(ans)

Solution (Python):
r,g,b,n=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)

Solution (Python):
R,G,B,N=map(int,input().split())

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

Solution (Python):
R,G,B,N=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)

Solution (Python):
def main():
    r, g, b, n = map(int, input().split())
    ans = 0
    x, y = 0, 0
    while r*x <= n:
        m = n - r*x
        y = 0
        while g*y <= m:
            if (m - g*y) % b == 0:
                ans += 1
            y += 1
        x += 1
    print(ans)

if __name__ == "__main__":
    main()

Solution (Python):
R, G, B, N = list(map(int, input().split()))
ans = 0
for b in range(3001):
    for g in range(3001):
        if (N - b*B - g*G) % R == 0 and (N - b*B - g*G) >= 0:
            
            ans += 1
print(ans)

Solution (Python):
r,g,b,N=map(int,input().split())
c=0
for i in range(N//r+1):
    for j in range(N//g + 1):
        t = (N-i*r-j*g)
        if t%b ==0 and t>=0:
            
            c+=1
print(c)

Solution (Python):









import sys



ipti = sys.stdin.readline
MOD = 10 ** 9 + 7
INF = float('INF')
sys.setrecursionlimit(10 ** 5)

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

    for rn in range(r_max+1):
        rem = n - r * rn
        g_max = rem // g
        for gn in range(g_max+1):
            rem2 = rem - g * gn
            if rem2 % b == 0:
                ans += 1

    print(ans)

if __name__ == '__main__':
    main()

Solution (Python):
r,g,b,n = map(int, input().split())
res = 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 or n - i * r - j * g == 0:
      res = res + 1
print(res)

Solution (Python):
r,g,b,n = map(int,input().split())
r1 = 0
count = 0

while r*r1 <= n:
    g1 = 0
    while r*r1+g*g1 <= n:
        if (n-(r*r1+g*g1))%b==0:
            count += 1
        g1 += 1
    r1 += 1
print(count)

Solution (Python):
r,g,b,n=map(int,input().split())
cnt=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:
            cnt+=1
print(cnt)

Solution (Python):
r,g,b,n = map(int,input().split())
res = 0
for rr in range(0, n // r + 1):
    for gg in range(0, (n - rr) // g + 1):
        if (n - r*rr - g*gg) < 0:
            break
        if (n - r*rr - g*gg) % b == 0:
            res += 1
print(res)

Solution (Python):
from sys import stdin


def main():
    R, G, B, N = [int(x) for x in stdin.readline().rstrip().split()]
    count = 0
    for r in range(3001):
        if N < r * R:
            break
        for g in range(3001):
            if N < g * G:
                break
            tmp = N - (R * r + G * g)
            if tmp < 0:
                break
            if tmp % B == 0:
                count += 1
    print(count)


if __name__ == "__main__":
    main()

Solution (Python):
r, g, b, n = map(int, input().split())

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

print(cnt)

Solution (Python):
r, g, b, n = 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)

Solution (Python):
R,G,B,N=map(int,input().split())
cnt=0
for i in range(0,N//R+1):
    buf=N-i*R
    for j in range(0,buf//G+1):
        
        if (buf-j*G)%B==0:
            cnt=cnt+1
print(cnt)

Solution (Python):
R, G, B, N = map(int, input().split())

a = [R, G, B]
a.sort()

x = N // a[2]
ans = 0
for i in range(x+1):
    n = N - (i * a[2])
    y = n // a[1]
    for j in range(y+1):
        if (n - a[1] * j) % a[0] == 0:
            ans += 1
print(ans)

Solution (Python):
r,g,b,n = map(int,input().split())

   

if r != 1 or g != 1:
 ans = 0
 for i in range(n//r +1):
    for j in range(n//g +1):
        if (n - i*r - j*g) < 0 :
            pass
        elif (n - i*r - j*g) % b == 0:
            ans += 1
 print(ans)

else:
    tmp = n // b
    ans =  0
    for i in range(tmp+1):
        ans += n - i + 1
    print(ans)

Solution (Python):
r,b,g,n = map(int, input().split( ))
ans = 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:
            ans += 1
print(ans)

Solution (Python):
R, G, B, N = map(int, input().split())
ans = 0
for r in range((N//R)+1):
    for g in range((N//G)+1):
        v = R * r + G * g
        if v > N:
            break
        if (N - v) % B == 0:
            ans +=1 
        
print(ans)