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 = 0
for i in range(n // r + 1):
    for j in range(n // g + 1):
        m = r * i + g * j
        if m <= n and (n - m) % b == 0:
            ans += 1
        elif m > n:
            break

print(ans)

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

answer=0
for r in range(N//R+1):
  for g in range(N//G+1):
    b_ball=N-r*R-g*G
    if b_ball<0:
      break
    elif b_ball%B==0:
      
      answer+=1
      
print(answer)

Solution (Python):
R,G,B,N=map(int,input().split())
ans=0
for r in range(3000+1):
  for g in range(3000+1):
    temp=r*R+g*G
    if N>=temp and (N-temp)%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):
    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
rgb = sorted([r,g,b])
n_rgb = []
for e in rgb:
  n_rgb.append(n//e)
for i in range(n_rgb[2]+1):
  N2 = n-i*rgb[2]
  for j in range(n_rgb[1]+1):
    N = N2 - j*rgb[1]
    if  N>=0 and N%rgb[0]==0:
      ans+=1
      
print(ans)

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

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

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

cnt = 0
for i in range(n//r + 1):
    for j in range(n//g + 1):
        nb = (n - (i*r+j*g))

        if (nb >= 0):
            if (nb % b == 0):
                cnt += 1
        else:
            break

print(cnt)

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

dp=[0 for _ in range(n+1)]
dp[0]=1

for i in range(3):
    for j in range(a[i],n+1):
        dp[j]+=dp[j-a[i]]

print(dp[-1])

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

cnt = 0
for r in range(0, N + 1):
  for g in range(0, N + 1):
    tmp_N = r * R + g * G
    if tmp_N > N:
      continue
    if (N - tmp_N) % B == 0:
      cnt += 1
print(cnt)

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

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

if __name__ == "__main__":
    solve()

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

if __name__ == "__main__":
    main()

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

count = 0

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

print(count)

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

Solution (Python):
R,G,B,N = map(int,input().split())
cnt = 0
R_1 = N//R
for i in range(R_1+1):
    G_1 = (N - i*R)//G
    for j in range(G_1+1):
        if (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 i in range(N+1):
    for j in range(N+1):
        k = (N-R*i-G*j)//B
        if i>=0 and j>=0 and k>=0 and R*i+G*j+B*k==N:
            cnt+=1
print(cnt)

Solution (Python):









import os
import sys




def main():
    R, G, B, N = map(int, input().split())
    r_max = N//R
    g_max = N//G
    b_max = N//B
    cnt = 0
    for r in range(r_max+1):
        ans = r*R
        for g in range((N-r*R)//G+1):
            ans += g*G
            if (N-ans)%B==0:
                cnt += 1
            ans = r*R
    print(cnt)





if __name__ == "__main__":
    main()

Solution (Python):
R,G,B,N = [int(i) for i in input().split()]
c = 0
for i in range(0,N+1,R):
    for j in range(0,N+1,G):
        if (N - i - j) < 0:
            break
        if (N - i - j)%B == 0:
            c += 1
print(c)

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

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

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

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

print(ans)

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

Solution (Python):




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

ans = 0


for ir in range(n+1):
    vr = r * ir 
    if vr > n:
        break

    for ig in range(n+1):
        vg = g * ig 
        if vg + vr > n:
            break
        cb = n - vr - vg
        if cb % b == 0:
            ans = ans + 1


print(ans)

Solution (Python):




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

ans = 0


for ir in range(n+1):
    vr = r * ir 
    if vr > n:
        break

    for ig in range(n+1):
        vg = g * ig 
        if vg > n:
            break
        cb = n - vr - vg
        if cb >= 0 and cb % b == 0:
            ans = ans + 1


print(ans)

Solution (Python):



from fractions import gcd
from itertools import combinations,permutations,accumulate 

from collections import deque,defaultdict,Counter
import decimal
import re












import sys
sys.setrecursionlimit(10000000)
mod = 10**9 + 7

def readInts():
  return list(map(int,input().split()))
def I():
  return int(input())
R,G,B,n = readInts()
cnt = 0
for r in range(n+1):
    for g in range(n+1):
        b = n - r*R - g*G
        
        if b >= 0:
            if b%B == 0:
                cnt += 1
print(cnt)

Solution (Python):
R,G,B,N = map(int, input().split())
cnt = 0
for r in range(0,N+1,R):
    for g in range(0,N+1,G):
        if r+g > N:break
        if (N-r-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):
        n = N-r*R-g*G
        if n>=0 and n%B==0:
            cnt += 1
print(cnt)

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

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

ans=0
i=0
while i<=3000:
    j=0
    while j<=3000 and N-(i*R+j*G)>=0:
        if (N-(i*R+j*G))%B==0:
            ans+=1
        j+=1
    i+=1

print(ans)

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

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

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

Solution (Python):
import bisect, collections, copy, heapq, itertools, math, string, sys
input = lambda: sys.stdin.readline().rstrip() 
sys.setrecursionlimit(10**7)
INF = float('inf')
def I(): return int(input())
def F(): return float(input())
def SS(): return input()
def LI(): return [int(x) for x in input().split()]
def LI_(): return [int(x)-1 for x in input().split()]
def LF(): return [float(x) for x in input().split()]
def LSS(): return input().split()

def resolve():
    R, G, B, N = LI()

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

    print(ans)

if __name__ == '__main__':
    resolve()

Solution (Python):

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

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 r in range(0, 3001):
    for g in range(0, 3001):
        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=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:
      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 i in range(N//R + 1):
  r = N - R*i
  for j in range(r//G + 1):
    if not (r - G*j) % B:
      ans += 1
      
print(ans)

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 r in range(N+1):
    for g in range(N+1):
        num_box, amari = divmod(N-R*r-G*g, B)
        if num_box >= 0 and amari == 0:
            ans += 1
print(ans)

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

l = sorted([r, g, b])
x = l[0]
y = l[1]
z = l[2]

ans = 0

mz = n // z
for i in range(mz + 1):
    my = (n - z * i) // y
    for j in range(my + 1):
        if (n - z * i - y * j) % x == 0:
            ans += 1

print(ans)

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

Solution (Python):
R, G, B, N = [int(i) for i in input().split()]

cnt = 0
for r in range(0, N // R + 1):
  for g in range(0, (N - r * R) // G + 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())

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

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

Solution (Python):


def solve(r,b,g,n):
  r_max = n // r
  b_max = n // b
  g_max = n // g
  ans = 0
  for i in range(r_max+1):
    for j in range(b_max+1):
      rest = n - (r*i + b*j)
      if rest >= 0 and rest % g == 0:
        ans += 1
  return ans



def main():
  R,G,B,N = map(int,input().split())
  print(solve(R,G,B,N))
  return

if __name__ == '__main__':
  main()

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

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

ans = 0
for i in range(ceil(n/r)+1):
  for j in range(ceil(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())
li = sorted([R,G,B])
ans = 0
for i in range(N//li[2]+1):
    for j in range((N-R*i)//li[1]+1):
        t = N - li[2]*i - li[1]*j
        if t < 0:
            continue
        if t % li[0] == 0:
            ans+=1
print(ans)

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

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

Solution (Python):
R, G, B, N = [int(_) for _ in input().split()]

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

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

res = 0
v = 0
for i in range(n//r+1):
    for j in range(n//g+1):
        v = n-(i*r+j*g)
        
        if 0 <= v and v % b == 0:
            res += 1
        if v<0:break
print(res)

Solution (Python):

import sys
from collections import deque, defaultdict
from math import sqrt, factorial





def solve():
    a,b,c,n = [int(x) for x in input().split()]
    cnt = 0
    for i in range(0,n+1,a):
        for j in range(0,n+1,b):
            if i + j == n or (
                i + j < n and (
                    (n - (i + j)) % c == 0
                )):
                cnt += 1
    print(cnt)


    

t = 1

for case in range(1,t+1):
    ans = solve()


"""

1 + k



"""

Solution (Python):

import sys
from collections import deque, defaultdict
from math import sqrt, factorial





def solve():
    a,b,c,n = [int(x) for x in input().split()]
    d = [0] * 10000
    d[0] = 1
    for i in range(0,5000):
        d[i + a] += d[i]
    for i in range(0,5000):
        d[i + b] += d[i]
    for i in range(0,5000):
        d[i + c] += d[i]

    print(d[n])
    

t = 1

for case in range(1,t+1):
    ans = solve()


"""

1 + k



"""

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

if R == 1 and G == 1:
  for b in range(N//B+1):
    ans += N-b*B+1

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

print(ans)

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

Solution (Python):
import sys, os, math, bisect, itertools, collections, heapq, queue

from decimal import Decimal
from collections import defaultdict, deque

sys.setrecursionlimit(10000000)

ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = lambda: list(map(int, sys.stdin.buffer.readline().split()))
fl = lambda: list(map(float, sys.stdin.buffer.readline().split()))
iln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]

iss = lambda: sys.stdin.buffer.readline().decode().rstrip()
sl = lambda: list(map(str, sys.stdin.buffer.readline().decode().split()))
isn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]

lcm = lambda x, y: (x * y) // math.gcd(x, y)

MOD = 10 ** 9 + 7
MAX = float('inf')


def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

    R, G, B, N = il()
    rlimit = (N // R) + 1
    glimit = (N // G) + 1

    ret = 0
    for r in range(rlimit):
        for g in range(glimit):
            n = N - (R * r + G * g)
            if n > -1 and n % B == 0:
                ret += 1
    print(ret)


if __name__ == '__main__':
    main()

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

i = 0
cnt = 0

while i*R <= N:
  j = 0
  while i*R + j*G <= N:
    if (N - i*R - j*G) % B == 0:
      cnt += 1
    j += 1
  i += 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):
        tmp = (r*i)+(g*j)
        if tmp > n:
            break
        else:
            if (n-tmp)%b == 0:
                ans += 1

print(ans)

Solution (Python):

import sys


def input(): return sys.stdin.readline().strip()
def I(): return int(input())
def LI(): return list(map(int, input().split()))
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def S(): return input()
def LS(): return input().split()


INF = float('inf')


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

Solution (Python):
from collections import defaultdict
from collections import deque
import itertools
import copy

def readInt():
	return int(input())
def readInts():
	return list(map(int, input().split()))
def readChar():
	return input()
def readChars():
	return input().split()

R,G,B,n = readInts()
ans = 0
for r in range(n//R+2):
	for g in range(n//G+2):
		t = n-(r*R+g*G)
		if t%B==0 and t>=0:
			ans+=1

print(ans)

Solution (Python):




import sys
from fractions import gcd
import math
from math import ceil,floor
import collections
from collections import Counter
import itertools
import copy














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

ans = 0
tmp1 = N//R + 1

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

Solution (Python):





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



ans = []

r, g, b = 0, 0, 0
cnt = 0

max_r = N // R
for r in range(max_r + 1):
    if R * r > N:
        break

    max_g = (N - R * r) // G

    for g in range(max_g + 1):
        if R * r + G * g > N:
            break
        x = (N - (R * r + G * g))
        if x % B == 0 and x >= 0:
            
            
            cnt += 1
            


print(cnt)

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

ans=0
for r in range(3001):
    for g in range(3001):
        b=(N-r*R-g*G)//B

        if b>=0 and r*R+g*G+b*B==N:
            ans+=1

print(ans)

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

main()

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

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

numbers=[R,G,B]
new_numbers=sorted(numbers,reverse=True)
a=new_numbers[0]
b=new_numbers[1]
c=new_numbers[2]

answer=0

for n in range(N//a+1):
    A=a*n
    B=N-A
    for n_ in range(B//b+1):
        C=n_*b
        D=B-C
        if D%c==0:
            answer+=1
print(answer)

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

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

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

def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))

def main():
    mod=10**9+7
    R,G,B,N=MI()
    ans=0
    for r in range(0,N+1,R):
        for g in range(0,N+1-r,G):
            b=N-r-g
            if b%B==0:
                ans+=1
                
    print(ans)

main()

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

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

    print(ans)


if __name__ == "__main__":
    main()

Solution (Python):


import sys
from typing import Any, Callable, Deque, Dict, List, Mapping, Optional, Sequence, Set, Tuple, TypeVar, Union































def main():
    Num = Union[int, float]
    mod = 1000000007                
    inf = float('inf')              
    
    sys.setrecursionlimit(10**6)    
    def input(): return sys.stdin.readline().rstrip()
    def ii():    return int(input())
    def isp():   return input().split()
    def mi():    return map(int, input().split())
    def mi_0():  return map(lambda x: int(x)-1, input().split())
    def lmi():   return list(map(int, input().split()))
    def lmi_0(): return list(map(lambda x: int(x)-1, input().split()))
    def li():    return list(input())
    
    
    
    red, green, blue, n = mi()

    cnt = 0
    for r in range(n // red + 1):
        for g in range(n // green + 1):
            if r * red + g * green > n:
                break
            res = n - (r * red + g * green)
            if res % blue == 0:
                cnt += 1
    print(cnt)


if __name__ == "__main__":
    main()

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

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

rr=n//r+1
gg=n//g+1
bb=n//b+1
ans=0
for i in range(rr):
  for j in range(gg):
    x=i*r+j*g
    if (x>n):
      break
    if (n-x)%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):
    tmp = N - R*r
    for g in range(tmp//G+1):
        check =  tmp - G*g
        if check%B == 0 and check >= 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):
    tmp = N - R*r
    for g in range(tmp//G+1):
        if (tmp - 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):
    x = N-R*r
    for g in range(x//G+1):
        if (x-G*g)%B==0:
            ans+=1
print(ans)

Solution (Python):

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




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

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

    cnt = 0
    for r in range(0,3000+1):
        for g in range(0,3000+1):
            b = N - (r * R + g * G)
            if b >= 0 and b % B == 0:
                cnt += 1
    
    print(cnt)
        
if __name__ == '__main__':
    solve()

Solution (Python):
[A,B,C,N]=[int(i) for i in input().split()]
X=[A,B,C]
X.sort()
[C,B,A]=X
cnt=0
for i in range(N//A+1):
  k=N-(i*A)
  for j in range(k//B+1):
    if (k-(B*j))%C==0:
    	cnt+=1
print(cnt)

Solution (Python):
R,G,B,N = map(int,input().split())
c = sorted([R,G,B])
R = c[1]
G = c[2]
B = c[0]
ans = 0
for r in range(N//R+1):
    tmp = N - r*R
    for g in range(N//G+1):
        ttmp = tmp - g*G
        ans += (ttmp%B == 0 and ttmp >= 0)
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):
        tmp = N - r*R - g*G
        if tmp >= 0 and tmp%B == 0:
            ans += 1
print(ans)

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

S=0
for x in range(M+1):
    for y in range(M+1):
        c=N-(R*x+G*y)
        if c>=0 and c%B==0:
            S+=1

print(S)

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

Solution (Python):
ans = 0
r,g,b,n = map(int,input().split())
for i in range(n//r+1):
	targ = i*r
	for j in range(n//g+1):
		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())

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

print(ans)

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



def main():
    R, G, B, N = [int(n) for n in input().strip().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 and (N - (R * r) - (G * g)) // B >= 0:
                ans += 1
    return ans


if __name__ == '__main__':
    print(main())

Solution (Python):



from fractions import gcd
from itertools import combinations,permutations 

from collections import deque,defaultdict











import sys
sys.setrecursionlimit(10000000)
mod = 10**9 + 7

def readInts():
  return list(map(int,input().split()))
def I():
  return int(input())

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

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

count = 0

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

print(count)

Solution (Python):



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


count = 0


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


print(count)

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

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

Solution (Python):
from copy import deepcopy
import math
import string
import collections
from collections import Counter
from collections import deque
from decimal import Decimal
import sys
import fractions
from operator import itemgetter
import itertools
import copy


def readints():
    return list(map(int, input().split()))


def nCr(n, r):
    return math.factorial(n)//(math.factorial(n-r)*math.factorial(r))


def has_duplicates2(seq):
    seen = []
    for item in seq:
        if not(item in seen):
            seen.append(item)
    return len(seq) != len(seen)


def divisor(n):
    divisor = []
    for i in range(1, n+1):
        if n % i == 0:
            divisor.append(i)
    return divisor



dx = [-1, -1, -1, 0, 0, 1, 1, 1]
dy = [-1, 0, 1, -1, 1, -1, 0, 1]













r, g, b, m = map(int, input().split())
cnt = 0
for i in range(3001):
    for j in range(3001):
        if r*i+g*j <= m:
            tmp = m-(r*i+g*j)
            if tmp % b == 0:
                cnt += 1
print(cnt)

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

Solution (Python):


import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from collections import Counter, deque
from collections import defaultdict
from itertools import combinations, permutations, accumulate, groupby, product
from bisect import bisect_left,bisect_right
from heapq import heapify, heappop, heappush
from math import floor, ceil,pi,factorial
from operator import itemgetter
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
def LI2(): return [int(input()) for i in range(n)]
def MXI(): return [[LI()]for i in range(n)]
def SI(): return input().rstrip()
def printns(x): print('\n'.join(x))
def printni(x): print('\n'.join(list(map(str,x))))
inf = 10**17
mod = 10**9 + 7

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