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

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

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

Solution (Python):
def xx(a,b,c):
    ans=0
    if c%a == 0:
        ans += 1
    while c>0:
        if c%b == 0:
            ans+=1
        c -= a
    return ans


r,g,b,n = map(int,input().split())
ans = 0
if n%r==0:
    ans += 1
while n>0:
    ans += xx(g,b,n)
    n -= r
print(ans)

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

def is_integer_num(n):
    if isinstance(n, int):
        return True
    if isinstance(n, float):
        return n.is_integer()
    return False

ans = 0

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

print(ans)

Solution (Python):
from sys import stdin
R,G,B,N=[int(x) for x in stdin.readline().rstrip().split()]
ans=0
for r in range(0,N//R+1):
    for g in range(0,(N-(R*r))//G+1):
        if (N - R*r - G*g) % B == 0:
            ans+=1
print(ans)

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

Solution (Python):
import math
 
R,G,B,N = map(int,input().split())
 
maxRBox = math.ceil(3000/R)
maxGBox = math.ceil(3000/G)
maxBBox = math.ceil(3000/B)
 
ans = 0
for ri in range(maxRBox+1):
	if N < ri*R:
		break
	for gi in range(maxGBox+1):
		if N < ri*R+gi*G:
			break
			
		if (N - (ri*R+gi*G)) % B == 0:
			bi = (N - (ri*R+gi*G)) // B
			if ri*R+gi*G+bi*B == N:
				ans +=1
				
				
print(ans)

Solution (Python):
r,g,b,n=map(int,input().split())
ans=0
for i in range(n//b+1):
    bi=b*i
    for j in range(n//g+1):
        gj=g*j
        if gj+bi>n:
            break
        elif gj+bi==n:
            ans=ans+1
            break
        elif (n-(gj+bi))%r==0:
            ans=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):
        k = n - (i*r + j*g)
        if k < 0:
            break
        elif k >= 0 and k%b == 0:
            ans += 1
print(ans)

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

ans = 0
X = N // R
Y = N // G
Z = N // B

for i in range(X + 1):
    for j in range(Y + 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):
        dif = (N - R * r - G * g)
        if dif < 0:
            break 
        if dif % B == 0:
            ans +=1
print(ans)

Solution (Python):










































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

if B > R:
    B, R = R, B
if B > G:
    B, G = G, B

for r_i in range(N + 1):
    if r_i * R > N:
        break
    for g_i in range(N + 1):
        if r_i * R + g_i * G > N:
            break
        if (N - (r_i * R + g_i * G)) % B == 0:
            ans += 1

print(ans)

Solution (Python):
def gcd(a_gcd, b_gcd):
    while b_gcd != 0:
        a_gcd, b_gcd = b_gcd, a_gcd % b_gcd
    return a_gcd


def lcm(a_lcm, b_lcm):
    return a_lcm * b // gcd(a_lcm, b_lcm)


def max_sum(N_max_sum, a_max_sum):
    dp = [0] * (N_max_sum + 1)
    for i in range(N_max_sum):
        dp[i + 1] = max(dp[i], dp[i] + a_max_sum[i])
    return dp[N]


def knapsack(N_knapsack, W, weight, value):
    inf = float("inf")
    dp = [[-inf for _ in range(W+1)] for j in range(N_knapsack + 1)]
    for i in range(W+1):
        dp[0][i] = 0

    for i in range(N_knapsack):
        for w in range(W+1):
            if weight[i] <= w:
                dp[i+1][w] = max(dp[i][w-weight[i]]+value[i], dp[i][w])
            else:
                dp[i+1][w] = dp[i][w]
    return dp[N_knapsack][W]












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

for r_i in range(N + 1):
    if r_i * R > N:
        break
    for g_i in range(N + 1):
        if r_i * R + g_i * G > N:
            break
        if (N - (r_i * R + g_i * G)) % B == 0:
            ans += 1

print(ans)

Solution (Python):
import numpy as np
I=lambda:map(int,input().split())
R,G,B,N=I()
r=0
rG = N-np.array(range(N//G+1))*G
for i in range(N//R+1):
    rB=rG-i*R
    r+=np.sum((rB>=0)&(rB%B==0))
print(r)

Solution (Python):
a, b, c, d = (int(_) for _ in input().split())  

res = 0
for i in range(0,d+1,a):
    for ii in range(0,d-i+1,b):
        if (d - i - ii) % c == 0:
            res += 1

print(res)

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

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



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

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

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

    print(ans)


if __name__ == '__main__':
    main()

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())
count = 0

for i in range(N+1):
    r = R*i
    for j in range(N+1):
        g = G*j
        k = int((N-r-g)/B)
        if 0 <= k and r+g+(B*k) == N:
            count += 1

print(count)

Solution (Python):


import sys
def p(*a):
  s=" ".join(map(str,a))
  
  sys.stderr.write(s+"\n")


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

if R<G: R,G=G,R
if G<B: G,B=B,G
if R<G: R,G=G,R

r=g=b=0
ans=0






for r in range(N//R+2):
	if (R*r)>N: break

	for g in range(N//G+2):
		if (R*r)+(G*g)>N:
			break
			X.append("break")
		
		b = (N-(R*r)-(G*g))//B
		n = (R*r)+(G*g)+(B*b)
		if n==N:
			ans+=1



print(ans)

Solution (Python):


import sys
def p(*a):
  s=" ".join(map(str,a))
  
  sys.stderr.write(s+"\n")


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

if R<G: R,G=G,R
if G<B: G,B=B,G
if R<G: R,G=G,R

r=g=b=0
ans=0






for r in range(N//R+2):
	if (R*r)>N: break

	for g in range(N//G+2):
		if (R*r)+(G*g)>N:
			break
			X.append("break")
		
		b = (N-(R*r)-(G*g))//B
		n = (R*r)+(G*g)+(B*b)
		if n==N:
			ans+=1



print(ans)

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

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

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

Solution (Python):
l = list(map(int, input().split(' ')))




r=l[0]
g=l[1]
b=l[2]
N=l[3]

Num=3000

sum = 0
for i in range(N//r+1):
    for j in range(N//g+1):
        _b=N-i*r-j*g
        if _b<0:
            break
        if _b%b==0:
            sum+=1
print(sum)

Solution (Python):
import sys
R, G, B, N = map(int, sys.stdin.readline().split())
print(len([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]))

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 = 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 = 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 = 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, 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=map(int,input().split())
count=0
wa=0
for i in range(int(N/R)+1):
    for j in range(int((N-i*R)/G)+1):
        b=(N-i*R-j*G)/B
        if b>=0 and float.is_integer(b)==True:
            count=count+1

print(count)

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

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

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

print(count)

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

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

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

Solution (Python):
a = list(map(int,input().split()))
a1 = a[:3]
b = sorted(a1)
num = a[3] // b[2]
count = 0
if num >= 1:
  for i in range(num+1):
    c = a[3] - (b[2] * i)
    num1 = c // b[1]
    if num1 >= 1:
      for j in range(num1+1):
        d = c - (b[1] * j)
        num3 = d / b[0]
        if num3.is_integer() is True:
          count += 1
    elif num1 == 0:
      num2 = c / b[0]
      if num2 >=0 and num2.is_integer() is True:
        count += 1
elif num < 1:
  num4 = a[3] // b[1]
  if num4 >= 1:
    for i in range(num4+1):
      g = a[3] - (b[1] * i)
      num5 = g / b[0]
      if num5.is_integer() is True:
          count += 1
  else:
    num6 = a[3] / b[0]
    if num6 >= 0 and num6.is_integer() is True:
      count += 1
elif a[3] < a[2] and a[3] < a[1] and a[3] < a[0]:
  count = 0 
print(count)

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

c = 0
for r in range(0, N + 1, R):
	for g in range(0, N + 1, G):
		if N < r + g:
			break
		d = N - r - g
		if not d % B:
			c += 1
	
"""
	for g in range(N + 1):
		if N < r * R + g * G:
			break
		x = (N - r * R - g * G)
		if not (x % B) and (0 <= (x // B)):
			
			c += 1
"""
print(c)

Solution (Python):

r, g, b, n = (int(_) for _ in input().split())
red = n // r
sets = []
ans = 0
for i in range(red + 1):
    remainder = n - (r*i)
    green = remainder // g
    if remainder == 0:
        ans += 1
    else:
        for j in range(green+1):
            nremainder = remainder - j*g
            if nremainder == 0:
                ans += 1
            elif nremainder > 0 and nremainder % b == 0:
                k = nremainder // b
                ans += 1

print(ans)

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

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

cnt = 0

for red in range(n // r + 1):

    for green in range((n - r * red) // g + 1):

        blue = n - red * r - green * g

        if blue >= 0 and blue % b == 0:

            cnt += 1

print(cnt)

Solution (Python):
from sys import stdin
R,G,B,N=[int(x) for x in stdin.readline().rstrip().split()]
ans=0
for r in range(0,N//R+1):
    for g in range(0,(N-(R*r))//G+1):
        if (N - R*r - G*g) % B == 0:
            ans+=1
print(ans)

Solution (Python):
from sys import stdin
r, g, b, n = [int(x) for x in stdin.readline().rstrip().split()]

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

print(ans)

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

ans = int(0)
x = int(N//R)

for i in range(x+1):
    t = N-i*R
    y = int(t//G)
    for j in range(y+1) :
        s = int(t-G*j)
        if s%B==0 : ans +=1

print(ans)

Solution (Python):
R, G, B, N = map(int, input().split())
ans = 0
r, g = 0, 0
rmax = N // R
gmax = N // G

if R * G * B == 1:
  for i in range(N + 1):
    ans += N + 1 - i
  print(ans)
  exit()

for i in range(rmax + 1):
  for j in range(gmax + 1):
    if (N - i * R - j * G) < 0:
      break
    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())

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

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

ans = 0
L = sorted([R,G,B], reverse=True)
for i in range(N//L[0]+1):
    for j in range((N-i*L[0])//L[1]+1):
        if (N-i*L[0]-j*L[1])%L[2] == 0:
                ans += 1

print(ans)

Solution (Python):
r, g, b, n = map(int, input().split())
x, y, z = sorted([r, g, b])

count=0
for i in range(0, n+x, x):
    for j in range(i, n+y, y):
        res = n-j
        if res%z == 0:
            count += 1
print(count)

Solution (Python):


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

counter = 0
for r in range(int(N/R) + 1):
    for g in range(int((N - r)/G) + 1):
        t = R*r + G*g
        if t > N:
            break
        if (N - t) % B == 0:
            counter += 1

print(counter)

Solution (Python):
R, G, B, N = [int(i) for i in input().split(" ")]
count = 0
for r in range(N // R + 1):
    for g in range(N // G + 1):
        _b = N - r * R - g * G
        if _b < 0:
            break
        if _b % B == 0:
            count += 1
print(count)

Solution (Python):
a = list(map(int,input().split()))
a1 = a[:3]
b = sorted(a1)
num = a[3] // b[2]
count = 0
if num >= 1:
  for i in range(num+1):
    c = a[3] - (b[2] * i)
    num1 = c // b[1]
    if num1 >= 1:
      for j in range(num1+1):
        d = c - (b[1] * j)
        num3 = d / b[0]
        if num3.is_integer() is True:
          count += 1
    elif num1 == 0:
      num2 = c / b[0]
      if num2 >=0 and num2.is_integer() is True:
        count += 1
elif num < 1:
  num4 = a[3] // b[1]
  if num4 >= 1:
    for i in range(num4+1):
      g = a[3] - (b[1] * i)
      num5 = g / b[0]
      if num5.is_integer() is True:
          count += 1
  else:
    num6 = a[3] / b[0]
    if num6 >= 0 and num6.is_integer() is True:
      count += 1
elif a[3] < a[2] and a[3] < a[1] and a[3] < a[0]:
  count = 0 
print(count)

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


def main():
    R, G, B, N = [int(ele) for ele in input().split()]
    ans = 0
    for i in range(N+1):
        tmp = N - i*R

        for j in range(N+1):
            tmp2 = tmp - j*G
            if tmp2 < 0:
                break
            if tmp2 % B == 0:
                ans += 1

    print(ans)


if __name__ == "__main__":
    main()

Solution (Python):
import math
line = [int(x) for x in input().split(" ")]
r = line[0]
g = line[1]
b = line[2]
n = line[3]
m = [r,g,b]
m.sort()
m.reverse()

res = 0

ro1 = list(range(math.floor(n / m[0]) + 1))
ro1.reverse()

for i in ro1:
    p = i * m[0]
    ro2 = list(range(math.floor((n - p) / m[1]) + 1))
    ro2.reverse()
    for j in ro2:
        q = p + j * m[1]

        if (n - q) % m[2] == 0:
            res += 1
print(res)

Solution (Python):
R,G,B,N= map(int,input().split())
count =0
l = [R,G,B]
l.sort(reverse = True)
for i in range(3002):
    if l[0]*i > N:
        break
    for j in range(3002):
        if l[0]*i + l[1]*j >N:
            break
        if (N-(l[0]*i + l[1]*j))%l[2] ==0:
            count +=1

print(count)

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

a1, a2, a3 = sorted([r, g, b])
ans = 0
a3n = n // a3
a2n = n // a2
for i in range(a3n + 1):
    for j in range(a2n + 1):
        r = n - (a3 * i + a2 * j)
        if r < 0:
            break
        if r % a1 == 0:
            ans += 1

print(ans)

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

a1, a2, a3 = sorted([r, g, b])
ans = 0
a3n = n // a3
a2n = n // a2
for i in range(a3n + 1):
    for j in range(a2n + 1):
        r = n - (a3 * i + a2 * j)
        if r < 0:
            break
        if r % a1 == 0:
            ans += 1

print(ans)

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


sum_rg = collections.defaultdict(int)

for i in range(n + 1):
    if n < r*i:
        break
    for j in range(n + 1):
        if n < r*i + g*j:
            break
        sum_rg[r*i + g*j] += 1

ans = 0
for k in range(n + 1):
    if n < b*k:
        break
    ans += sum_rg[n - b*k]


print(ans)

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

Solution (Python):
def solve():
    R,G,B,N = list(map(int,input().split())) 
    RGBs = sorted([R,G,B],reverse=True)
    count = 0
    if N < min(R,G,B):
        pass
    else:
        for i in range(int(N/RGBs[0])+1):
            O = N - i*RGBs[0]
            for j in range(int(O/RGBs[1])+1):
                P = O - j*RGBs[1]
                if P%RGBs[2] == 0:
                    count += 1
    print(count)


solve()

Solution (Python):
R,G,B,N = map(int,input().split(' '))
A,B,C = sorted([R,G,B])
if A==1 and B==1 and C ==1:
  print(int((N+2)*(N+1)/2))
  exit()
num = 0
E = int(N//C+1)
F = int(N//B+1)
for i in range(E):
  for j in range(F):
    X = N-C*i-B*j
    if X >= 0  and X % A == 0:
      num += 1
print(num)

Solution (Python):
R,G,B,N = map(int,input().split(' '))
A,B,C = sorted([R,G,B])
if A==1 and B==1 and C ==1:
  print(int((N+2)*(N+1)/2))
  exit()
num = 0
E = int(N//C+1)
F = int(N//B+1)
for i in range(E):
  for j in range(F):
    X = N-C*i-B*j
    if X >= 0  and X % A == 0:
      num += 1
print(num)

Solution (Python):
R, G, B, N = [int(i) for i in 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)):
        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 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

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)

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

Solution (Python):




a, b, c, d = map(int, input().split())

o = 0
for i in range((d//a)+1):
    for j in range(((d-a*i)//b)+1):
        if (d-a*i-b*j) % c == 0:
            o += 1

print(o)

Solution (Python):
from sys import stdin
import math
    
def calc(r,g,b,n):
    ans = 0

    for ri in range(0, math.floor(n/r)+1):
        numR = ri * r
        if n - numR == 0:
            ans += 1
            continue

        for gi in range(0, math.floor((n-numR)/g)+1):
            numG = gi * g

            left = n - numR - numG
            
            if left == 0:
                ans += 1
            elif left % b == 0:
                ans += 1
    return ans

def main():
    r,b,g,n = [int(x) for x in stdin.readline().rstrip().split()]
    ans = calc(r,b,g,n)
    print(ans)
    
if __name__=='__main__':
    main()

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

cnt = 0
sum = 0

for r in range(int(N/R)+1):
    sum = R*r
    for g in range(3001):
        if sum + G*g > N:
            break
        if (N-sum-(G*g))%B == 0:
            cnt += 1

print(cnt)

Solution (Python):


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

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



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






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

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):
def solve():
    R,G,B,N = list(map(int,input().split())) 
    RGBs = sorted([R,G,B],reverse=True)
    count = 0
    if N < min(R,G,B):
        pass
    else:
        for i in range(int(N/RGBs[0])+1):
            O = N - i*RGBs[0]
            for j in range(int(O/RGBs[1])+1):
                P = O - j*RGBs[1]
                if P%RGBs[2] == 0:
                    count += 1
    print(count)


solve()

Solution (Python):
def solve(R, G, B, N):
    ans = 0
    mr = N // R
    for i in range(mr + 1):
        mg = (N - i * R) // G
        for j in range(mg + 1):
            b = N - i * R - j * G
            if b % B == 0:
                ans += 1
    return ans


if __name__ == "__main__":
    R, G, B, N = map(int, input().split(" "))
    print(solve(R, G, B, N))

Solution (Python):
R, G, B, N= map(int, input().split())
c = 0
S = [R, G, B]
S.sort()
R = S[2]
G = S[1]
B = S[0]

if S[0] == 1:
  for i in range(N//R + 1):
    for j in range(N//G + 1):
      if R * i + G * j <= N:
        c += 1
else:
  for i in range(N//R + 1):
    for j in range(N//G + 1):
      for k in range(N//B + 1):
        if R * i + G * j + B * k == N:
          c += 1
print(c)

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

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

Solution (Python):


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

counter = 0
for r in range(int(N/R) + 1):
    for g in range(int(N/G) + 1):
        t = R*r + G*g
        if t > N:
            break
        if (N - t) % B == 0:
            counter += 1

print(counter)

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

        ans+=1

print(ans)

Solution (Python):




a, b, c, d = map(int, input().split())

o = 0
for i in range((d//a)+1):
    for j in range(((d-a*i)//b)+1):
        if (d-a*i-b*j) % c == 0:
            o += 1

print(o)

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

Solution (Python):
r,g,b,n = [int(x) for x in input().strip().split(" ")]
counter = 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:

            counter += 1
print(counter)

Solution (Python):
R, G, B, N = [int(x) for x in input().split()]
 
l = [R, G, B]
l.sort()
low, mid, top = l[0], l[1], l[2]
count = 0
for a in range(N//top + 1):
  temp = N - a * top
  for b in range(temp//mid + 1):
    temp_2 = temp - b * mid
    if temp_2 % low == 0:
      count += 1
print(count)

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

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

Solution (Python):
from sys import stdin
import math
import fractions
from collections import deque

INF = 10 ** 10

R, G, B, N = [int(x) for x in stdin.readline().rstrip().split()]

cnt = 0
R, G, B = sorted([R, G, B])
RN = N // R + 1
GN = N // G + 1
BN = N // B + 1

cnt = 0
for i in range(RN):
    tmpN = N - R*i
    if tmpN % G == 0:
        cnt += 1
    for j in range(GN):
        tmpN2 = tmpN - G*j
        if tmpN2 > 0 and tmpN2 % B == 0:
            cnt += 1
    

print(cnt)

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

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

print(cnt)

Solution (Python):
def inpl():
    return list(map(int, input().split()))


def gcd(a, b):
    
    la = max(a, b)
    sm = min(a, b)
    if la % sm == 0:
        return sm
    else:
        return gcd(sm, la - sm)


def lcm(a, b):
    
    return a * b // gcd(a, b)

import sys

sys.setrecursionlimit(5000)


R, G, B, N = inpl()
ans = 0
for r in range(N // R + 1):
    rest = N - r * R
    for i in range(B):
        if (G * i) % B == rest % B:
            x = i
            break
    else:
        
        continue
    if rest - G * x < 0:
        continue
    ans += (rest - G * x) // lcm(B, G) + 1
    

print(ans)

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

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

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

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

print(res)

Solution (Python):
R, G, B, N = map(int, input().split())
r, g, b = sorted([R, G, B], reverse=True)
ans = 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:
      ans += 1
print(ans)

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

count = 0
for i in range((N // R) + 1):
    ir = i * R
    for j in range(((N - ir) // G) + 1):
        jg = j * G
        k = (N - ir - jg) / B
        if k.is_integer():
            count += 1

print(count)

Solution (Python):
import sys
rr = lambda: sys.stdin.readline().strip()
ri = lambda: int(rr())
rs = lambda: [int(_) for _ in rr().split()]

R, G, B, N = rs()

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)

Solution (Python):


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

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

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

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

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