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

ans_count = 0

for red in range(int(N/R)+1):
  for green in range(int((N-red*R)/G)+1):
    if (N - red*R - green*G) % B ==0 :
      ans_count += 1

print(ans_count)

Solution (Python):
R,G,B,n=map(int,input().split())
sum_rg=[0 for i in range(n+1)]
for r in range(n+1):
	for g in range(n+1):
		tmp=R*r+G*g
		if tmp>n:
			break
		else:
			
			sum_rg[n-tmp]+=1

count=0
for i in range(n//B+1):
	count+=sum_rg[i*B]
print(count)

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

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

Solution (Python):
from sys import exit

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

count = 0

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

print(count)

Solution (Python):
import sys,heapq
from collections import deque,defaultdict
printn = lambda x: sys.stdout.write(x)
inn = lambda : int(input())
inl   = lambda: list(map(int, input().split()))
inm   = lambda:      map(int, input().split())
DBG = True 
def ddprint(x):
  if DBG:
    print(x)

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

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

ans = 0
for r in xrange(N + 1):
    for g in xrange(N + 1):
        cur = R * r + G * g
        if cur > N: break
        rem = N - cur
        if rem % B != 0: continue
        b = rem // B
        ans += 1

print ans

Solution (Python):
R, G, B, N = map(int,input().split())
 
i = 0
j = 0
cnt = 0
 
while i*R <= N:
    while i*R + j*G <= N:
        temp = N - i*R - j*G
        if temp % B == 0:
            cnt += 1
        j += 1
    j = 0
    i += 1
 
print(cnt)

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

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

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

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

ans=0

for count_r in range(N // R + 1):
    currnt_N = N - R * count_r
    for count_g in range(currnt_N // G + 1):
        
        currnt_N = N - R * count_r - G * count_g
        if currnt_N % B == 0:
            ans += 1
            
print(ans)

Solution (Python):
R,G,B,N=list(map(int,input().split()))
ans=0
if 1<=R<=3000 and 1<=G<=3000 and 1<=B<=3000 and 1<=N<=3000:
	limR=N//R
	for r in range(limR+1)[::-1]:
		zanGB=N-r*R
		limG=zanGB//G
		for g in range(limG+1):
			zanB=zanGB-g*G
			if zanB%B==0:
				b=zanB//B
				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//g+1):
        if (n-(i*r+j*g))%b==0:
            if 0<=n-i*r-j*g:
                ans+=1
print(ans)

Solution (Python):
import math
input = input().split()
r = int(input[0])
g = int(input[1])
b = int(input[2])
N = int(input[3])
 
count = 0


for x in range(math.ceil(N/r+0.0001)):
    for y in range(math.ceil((N-x*r)/g + 0.0001)):
        
        if  (N - x*r - y*g) % b == 0:
            count +=1
 
print(count)

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

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

            ans+=1

print(ans)

Solution (Python):
R,G,B,n=[int(x) for x in input().split()]
ans=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:
            ans+=1
print(ans)

Solution (Python):
r,g,b,n=list(map(int,input().split()))
i,j=0,0
R,G=0,0
c=0
while R<=n:
    while G<=n-R:
        if (n-R-G)%b==0:
            c+=1
        G+=g
    G=0
    R+=r

print(c)

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

Solution (Python):
'''input
13 1 4 3000
'''

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

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

print(count)

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 = 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)

Solution (Python):
r, g, b, n = map(int, raw_input().split())
count = 0
for i in xrange(n+1):
    if i*r > n:
        break	
    for j in xrange(n+1):
        if i*r + j*g > n:
            break
        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(N // R + 1):
    for j in range((N - R*i) // G + 1):
        if (N - i*R - j*G) % B == 0:
            ans += 1
            
print(ans)

Solution (Python):
import sys

def main(inp):
    r,g,b,n = map(int,next(inp).split())
    box = sorted([r,g,b],reverse = True)
    
    ans = 0
    for i in range(int(n/box[0])+1):
        for j in range(int((n-i*box[0])/box[1])+1):
            if((n-i*box[0]-j*box[1])%box[2] == 0):
                ans += 1
    
    return ans
  
print(main(sys.stdin))

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

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

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

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

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

Solution (Python):
R,G,B,N = [int(i) for i in input().split()]
num = 0
box = sorted([R,G,B], key=lambda x:-x)
nums = [N//b for b in box]
for i in range(nums[0]+1):
    if (nums[0]-i)*box[0] + nums[1]*box[1] + nums[2]*box[2] < N:
        break
    for j in range(nums[1]+1):
        resj = (nums[0]-i)*box[0] + (nums[1]-j)*box[1]
        if resj + nums[2]*box[2] < N:
            break
        if resj > N:
            continue
        if (N-resj)%box[2]!=0:
            continue
        num += 1
print(num)

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

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

Solution (Python):
read = input
A = list(map(int, read().split()))
n = A[-1]
A = A[:3]
A.sort(reverse=True) 
ans = 0
if A[1] == A[2] and A[1] == 1: 
    for i in range(n+1):
        tmp = i*A[0]
        if tmp > n:break

        ans += (n-tmp) - 0 + 1
else :
    for i in range(n+1):
        for j in range(n+1):
            tmp = i * A[0] + j * A[1]
            if tmp > n:break
            tmp = n - tmp
            if tmp % A[2] == 0:
    
                ans += 1
print(ans)

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

count = 0

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

print(count)

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-i*r-j*g)%b==0:
            ans+=1
print(ans)

Solution (Python):

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

Solution (Python):

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

Solution (Python):

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

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

ans = 0
for tmp_r in range(0, 3001):
    if r * tmp_r > n:
        break
    for tmp_g in range(0, 3001):
        if r * tmp_r + g * tmp_g > n:
            break
        if (n - (r * tmp_r + g * tmp_g)) % b == 0:
            ans += 1

print(ans)

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

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):
        tmp = N - r * R - g * G
        if tmp % B == 0:
            ans += 1

print(ans)

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

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

Solution (Python):
r, g, b, n = map(int, input().split())
 
count = 0
for i_r in range(0,int(n)+1):
    if (n - r*i_r)<0:continue
    for i_g in range(0,int(n)+1):
        if (n - r*i_r - g*i_g)<0:continue
        if 0==((n - r*i_r - g*i_g)%b):
 
            count +=1
 
print(count)

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

Solution (Python):
a, b, c, n = map(int, input().split())
aa =[a,b,c]
aa.sort()
r = aa[2]
g = aa[1]
b = aa[0]
 
count = 0
for i_r in range(0,int(n/r)+1):
    if (n - r*i_r)<0:continue
    for i_g in range(0,int((n-r*i_r)/g)+1):
        if (n - r*i_r - g*i_g)<0:continue
        if 0==((n - r*i_r - g*i_g)%b):
 
            count = count + 1
 
print(count)

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

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):
        tmp = N - r * R - g * G
        if tmp % B == 0:
            ans += 1

print(ans)

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

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

print(count)

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

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

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

    count = 0

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



    print(count)
                

if __name__=='__main__':
    main()

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

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

ans = 0
for b in range(N//B+1):
    N1 = N - b*B
    for g in range(N1//G+1):
        N2 = N1 - g*G
        if N2 % R == 0:
            ans += 1
print(ans)

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

x_max= N//R
y_max= N//G
ans=0

for x in range(x_max+1):
    for y in range(y_max+1):

        z= (N-R*x-G*y)//B

        if z >=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(N//R+1):
    for e in range((N-R*i)//G+1):
        if (N-i*R-e*G)%B==0:
            ans+=1
print(ans)

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

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

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-i*r-j*g)%b==0:
            ans+=1
print(ans)

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

Solution (Python):
import numpy as np

IN = input().split()

dp = np.zeros((4,3001))
dp[0][0] = 1

for i in range(3):
    for j in range(3001):
        dp[i+1][j] += dp[i][j]
    for j in range(3001):
        if(j - int(IN[i]) >= 0):
            dp[i+1][j] += dp[i+1][j - int(IN[i])]

print(int(dp[3][int(IN[3])]))

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

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

ans=0

for i in range(N+1):
  if i*R > N:
    break
  else:
    for j in range(N+1):
      if i*R+j*G > N:
        break
      else:
        if N-(i*R+j*G) == 0 or (N-(i*R+j*G)) % B == 0:
          ans+=1
          
print(ans)

Solution (Python):
import sys
def input(): return sys.stdin.readline().strip()

mi = lambda: map(int, input().split())

R, G, B, N = mi()

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

print(count)

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

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

ans = 0
r = 0

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

print(ans)

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

ans = 0

for i in range(3001):
    if i*r > n:
        break
    for j in range(3001):
        value = r*i + g*j
        if (n - value) < 0:
            break
        elif (n - value) % b == 0:
            ans += 1
print(ans)

Solution (Python):
R, G, B, N = map(int, input().split())
ans = 0
 
for Rx in range(0, N+1, R):
    for Gy in range(0, N+1, G):
        check = N - Rx - Gy
        if check % B == 0 and 0 <= check // B <= N // B:
            ans += 1
print(ans)

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

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

num_max_r = n//r

ans = 0
for num_r in range(num_max_r + 1):
    
    n_r = n - num_r*r
    num_max_g = n_r//g
    
    for num_g in range(num_max_g + 1):
        n_r_g = n_r - num_g*g
        
        if n_r_g >= 0 and n_r_g % b == 0:
            ans += 1

print(ans)

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

res=0
tmp=n
tmp1=0
re=n//r+1
ge=n//g+1

for i in range(re):
	tmp = tmp - i*r
	tmp1 = tmp
	for j in range(ge):
		tmp1 = tmp - j*g
		if tmp1 < 0:
			break
		elif tmp1%b==0:
			res = res + 1
		tmp1 = tmp
	tmp=n

print(res)

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

res=0
tmp=n
tmp1=0
re=n//r+1
ge=n//g+1

for i in range(re):
	tmp = tmp - i*r
	tmp1 = tmp
	for j in range(ge):
		tmp1 = tmp - j*g
		if tmp1 < 0:
			break
		elif tmp1%b==0:
			res = res + 1
		tmp1 = tmp
	tmp=n

print(res)

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

res=0
tmp=n
tmp1=0
re=n//r+1
ge=n//g+1

for i in range(re):
	tmp = tmp - i*r
	tmp1 = tmp
	for j in range(ge):
		tmp1 = tmp - j*g
		if tmp1 >= 0 and tmp1%b==0:
			res = res + 1
			
		tmp1 = tmp
	tmp=n

print(res)

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

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

print(sum)

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

print(ans)

Solution (Python):
from fractions import gcd
r,g,b,n=map(int,input().split())
t=0
for i in range(0,(n-1)//r+2):
    d=n-r*i
    if d%gcd(g,b)==0:
        c=0
        for j in range(0,(d-1)//b+2):
            if (d-j*b)%g==0:
                c=1
                break
        if c==1:
            t+=(d-j*b)//(g*b//gcd(g,b))+1
print(t)

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 r in range(int(N/R)+1):
    for g in range(int(N/G)+1):
        if r*R + g*G <= N:
            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 i in range(n+1):
    rcnt = r * i
    if rcnt > n:
        break
    
    for j in range(n+1):
        rgcnt = rcnt + g * j
        if rgcnt > n:
            break
        bcnt = n - rgcnt
        if bcnt % b == 0:
            cnt += 1

print(cnt)

Solution (Python):
inpl = lambda: list(map(int,input().split()))
R,G,B,N = inpl()
(R,G,B) = sorted([R,G,B])
ans = 0
for b in range(N//B+1):
    N1 = N - b*B
    for g in range(N1//G+1):
        N2 = N1 - g*G
        if N2 % R == 0:
            ans += 1
print(ans)

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

colors = sorted([r, g, b])

cnt = 0
for i in range(n // colors[2] + 1):
  for j in range((n - i*colors[2]) // colors[1] + 1):
    if (n - i*colors[2] - j*colors[1]) % colors[0] == 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-i*r-g*j)%b==0:ans+=1
print(ans)

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

count = 0


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

print(count)

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

ans=[]

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


print(count)

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

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

Solution (Python):
R,G,B,N = map(int, input().split())
rgb = [R,G,B]
rgb.sort(reverse = True)

ans = 0
for r in range(N//rgb[0]+1):
    n1 = N - rgb[0]*r
    for g in range(n1//rgb[1]+1):
        if (n1 - rgb[1]*g)%rgb[2] == 0:
            
            ans += 1

print(ans)

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

import numpy as np

r = np.arange(0, N+1, R, dtype=np.int64)
g = np.arange(0, N+1, G, dtype=np.int64)
r, g = np.meshgrid(r, g)
b = N - r - g

print(np.sum(((b%B)==0) & (b>=0)))

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


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

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) / B == (N - r * R - g * G) // B and (N - r * R - g * G) / B >= 0:
            ans += 1
print(ans)

Solution (Python):
import numpy as np
R, G, B, N = map(int, input().split())
r = np.arange(0, int(N/R)+1)
g = np.arange(0, int(N/G)+1)
rg = r[:, np.newaxis]*R+g[np.newaxis, :]*G
mask = (rg<=N) & ((N-rg)%B==0)
print(np.sum(mask))

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())

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 R*r+G*g <= N:
            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 + 1):
        T = i * r + j * g
        if T > n:
            break

        if (n - T) % b == 0:
            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 + 1):
        T = i * r + j * g
        if T > n:
            break

        if (n - T) % b == 0:
            cnt += 1
print(cnt)

Solution (Python):
def main():
    R, G, B, N = map(int, input().split())
    ans = 0
    cnt = 0
    for r in range(N + 1):
        for g in range(N + 1 - (R * r)):
            if (N - (R * r) - (G * g)) % B == 0 and N - (R * r) - (G * g) >= 0:
                cnt += 1
 
    print(cnt)
 
 
if __name__ == '__main__':
    main()

Solution (Python):


 
from collections import defaultdict
 
R, G, B, N = map(int, input().rstrip().split(' '))
A = [R, G, B]
 
dp = defaultdict(lambda: defaultdict(lambda: -1))
def rec(i, n):
    if dp[i][n] != -1:
        return dp[i][n]
    if n == 0:
        return 1
    if i == 2:
        return n % A[2] == 0
       
    temp = 0
    for j in range(n // A[i] + 1):
        temp += rec(i + 1, n - j * A[i])
        
    dp[i][n] = temp
    
    return temp
    
print(rec(0, N))

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

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

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):
        if (N-i*R-j*G) % B == 0:
            ans += 1
print(ans)

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

ans = 0
for delim1 in range(0, N + 1):
    for delim2 in range(delim1, N + 1):
        left = delim1
        middle = delim2 - delim1
        right = N - delim2
        if left % R == 0 and middle % G == 0 and right % B == 0:
            ans += 1
print(ans)

Solution (Python):
def B(info):
    rgb = [0]*3
    *rgb, n = map(int,info.split())
    rgb.sort(reverse = True)
    count = 0
    for i in range(n//rgb[0]+1):
        new_n = n - i*rgb[0]
        if new_n < rgb[2]:
            if new_n == 0:
                count += 1
            continue
        for j in range(new_n//rgb[1]+1):
            if (new_n-rgb[1]*j)%rgb[2] == 0:
                count += 1

    return count

    
if __name__ == '__main__':
    print(B(input()))

Solution (Python):
def b_rgb_boxes(R, G, B, N):
    """Rr+Gg+Bb=N となる非負整数(r, g, b)の組はいくつか。"""
    
    dp = [0] * (N + 1)
    dp[0] = 1
    for c in (R, G, B):
        for i in range(N + 1):
            if i + c <= N:
                
                
                dp[i + c] += dp[i]
    return dp[N]

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

Solution (Python):
R, B, G, N = (int(x) for x in input().split())
a = [R, B, G]
a = sorted(a)
b = a[2]
d = a[1]
f = a[0]
c = int(N / b)

count = 0

for i in range(c + 1):
    n = N - b * i
    e = int(n / d)
    for j in range(e + 1):
        m = n - d * j
        if m % a[0] == 0:
            count += 1

print(count)

Solution (Python):
import re
         
a,b,c,n = list(map(int,re.split(" ",input())))
N = n
s = []
s.append(a)
s.append(b)
s.append(c)
s.sort()
a,b,c = s

ans = 0
for i in range(int(N/c)+1):
  for j in range(int((N-i*c)/b)+1):
      if (N - i*c  - j*b)%a == 0:
        ans += 1
print(ans)

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

Solution (Python):



import itertools

intext = input()
[r, g, b, n] = map(int, intext.split())

rgb_list = [r, g, b]
rgb_list.sort(reverse=True)
[x, y, z] = rgb_list

cnt = 0
for x_val in range(0, n+1, x):
    
    for y_val in range(0, (y*((n-x_val)//z))+1, y):
        zan = n - x_val - y_val
        if zan >=0 and zan % z == 0:
            cnt += 1
print(cnt)

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

count = 0

tmp_lst = [R, G, B]
tmp_lst.sort()
X, Y, Z = tmp_lst[0], tmp_lst[1], tmp_lst[2]

x_max = int(N/X)    
y_max = int(N/Y)
z_max = int(N/Z)



for z in range(z_max + 1):
    for y in range(y_max + 1):
        tmp = N - z*Z - y*Y
        if tmp < 0:
            break
        if tmp % X == 0 and tmp // X <= x_max:

            count += 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-i*r)//g+1):
        if (n-i*r-j*g)%b==0:
            cnt+=1
print(cnt)

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

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

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

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

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

ans = 0

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

Solution (Python):
R, G, B, N = [int(s) for s in input().split()]
MAX = 3001
count = 0
proglist = [1 for r in range(MAX) for g in range(MAX) if (N-r*R-g*G) % B == 0 and (N-r*R-g*G) >= 0]
print(sum(proglist))

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

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

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

count = 0

for r in range(N//R+1):

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

print(count)