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

sum = 0
R_G_B = [R,G,B]
R_G_B.sort()
for i in range(N // R_G_B[2] + 1):
	for j in range((N - i * R_G_B[2]) // R_G_B[1] + 1):
		if (N - R_G_B[2] * i - R_G_B[1] * j) % R_G_B[0] == 0:
			sum += 1
			
print(sum)

Solution (Python):
RGBN = [int(i) for i in input().split()]
RGB = []
for i in range(3):
    RGB.append(RGBN[i])
RGB.sort()
N = RGBN[3]

count = 0
r = 0
g = 0
b = 0
for i in range(int(N/RGB[0])+1):
    for j in range(int((N-i*RGB[0])/RGB[1])+1):
        if (N - i*RGB[0] - j*RGB[1]) % RGB[2] == 0:
            count += 1

print(count)

Solution (Python):
s = input().split(" ")
s = [int(s[i]) for i in range(len(s))]
R = s[0]
G = s[1]
B = s[2]
N = s[3]






rst = 0
for k in range(int(N / R) + 1) : 
    for l in range(int( (N - k*R) / G) + 1) : 
        if (N - k * R - l * G) % B == 0  : 
            rst += 1
print(rst)

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

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

cd = collections.defaultdict
memo = cd(lambda: cd(int))


def dfs(res, color):
    if res < 0:
        return 0
    elif res == 0:
        return 1
    elif memo[res][color] == 0:
        if color == 0:
            memo[res][color] = dfs(res - R, 0) + dfs(res - G, 1) + dfs(
                res - B, 2)
        elif color == 1:
            memo[res][color] = dfs(res - G, 1) + dfs(res - B, 2)
        elif color == 2:
            memo[res][color] = dfs(res - B, 2)
    return memo[res][color]


print(dfs(N, 0))

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).is_integer():
        cnt+=1
print(cnt)

Solution (Python):
R, G, B, N = map(int, input().split())
a = N // R
t = 0
for i in range(a + 1):
    b = N - R*i
    c = b // G
    for l in range(c + 1):
        d = b - G*l
        if d % B == 0:
            t += 1
print(t)

Solution (Python):
R,G,B,N=map(int,input().split())
way=[R,G,B]
box=0
way.sort(reverse=True)
MAX=way[0]
SECOND=way[1]
MIN=way[2]
ways=int((N-N%MAX)/MAX)
for i in range(0,ways+1):
    sum=N-MAX*i
    way_2=int((sum-sum%SECOND)/SECOND)
    for j in range(0,way_2+1):
        sum_2=sum-SECOND*j
        if sum_2%MIN==0:
            box+=1
print(box)

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

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

Solution (Python):
red, green, blue, total = map(int, input().split(' '))

available_balls = [red, green, blue]
available_balls.sort(reverse=True)

num_combination = 0
for zero in range(0, (total // available_balls[0]) + 1):
    mod_ball = total - zero * available_balls[0]
    for one in range(0, (mod_ball // available_balls[1]) + 1):
        rest_ball = mod_ball - one * available_balls[1]
        
        if rest_ball % available_balls[2] == 0:
            num_combination += 1
            
        
        
        
        
        
        
        

print(num_combination)

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

i,j,k = 0,0,0

ans = 0



while True:
	temp = i * r
	j,k = 0,0
	if(temp > n):
		break
	while True:
		temp = i * r + j * g
		k = 0
		if(temp > n):
			break
		if((n - temp)%b == 0):
			ans+= 1
		j+= 1
	i += 1

print(ans)

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

count=0
for ri in range(int(n/r)+1):
    for gi in range(int((n-ri*r)/g)+1):
        sumc=n-ri*r-gi*g
        if sumc<0:
            break
        if sumc%b==0:
            count+=1

print(count)

Solution (Python):
R,G,B,N=(int(i) for i in input().split())
import math
answer=0
for r in range(0,math.floor(N/R)+1):
    for g in range(math.floor(N/G)+1):
        sss=R*r+G*g
        if sss>N:
            break
        if (N-sss)%B==0:
            answer+=1
print(answer)

Solution (Python):

"""<https://github.com/cheran-senthil/PyRival>"""
from __future__ import division, print_function

import os
import sys
from io import BytesIO, IOBase
from types import GeneratorType

if sys.version_info[0] < 3:
    from __builtin__ import xrange as range
    from future_builtins import ascii, filter, hex, map, oct, zip
else:
    _str = str
    str = lambda x=b"": x if type(x) is bytes else _str(x).encode()


def bootstrap(f, stack=[]):
    def wrappedfunc(*args, **kwargs):
        if stack:
            return f(*args, **kwargs)
        else:
            to = f(*args, **kwargs)
            while True:
                if type(to) is GeneratorType:
                    stack.append(to)
                    to = next(to)
                else:
                    stack.pop()
                    if not stack:
                        break
                    to = stack[-1].send(to)
            return to

    return wrappedfunc


def memodict(f):
    """ Memoization decorator for a function taking a single argument. """

    class memodict(dict):
        def __missing__(self, key):
            ret = self[key] = f(key)
            return ret

    return memodict().__getitem__


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


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




BUFSIZE = 8192


class FastIO(IOBase):
    newlines = 0

    def __init__(self, file):
        self._buffer = BytesIO()
        self._fd = file.fileno()
        self._writable = "x" in file.mode or "r" not in file.mode
        self.write = self._buffer.write if self._writable else None

    def read(self):
        if self._buffer.tell():
            return self._buffer.read()
        return os.read(self._fd, os.fstat(self._fd).st_size)

    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count(b"\n") + (not b)
            ptr = self._buffer.tell()
            self._buffer.seek(0, 2), self._buffer.write(b), self._buffer.seek(ptr)
        self.newlines -= 1
        return self._buffer.readline()

    def flush(self):
        if self._writable:
            os.write(self._fd, self._buffer.getvalue())
            self._buffer.truncate(0), self._buffer.seek(0)


def print(*args, **kwargs):
    """Prints the values to a stream, or to sys.stdout by default."""
    sep, file = kwargs.pop("sep", b" "), kwargs.pop("file", sys.stdout)
    at_start = True
    for x in args:
        if not at_start:
            file.write(sep)
        file.write(str(x))
        at_start = False
    file.write(kwargs.pop("end", b"\n"))
    if kwargs.pop("flush", False):
        file.flush()


sys.stdin, sys.stdout = FastIO(sys.stdin), FastIO(sys.stdout)
input = lambda: sys.stdin.readline().rstrip(b"\r\n")



if __name__ == "__main__":
    main()

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

N = INPUT.pop(3)
INPUT.sort()

res = 0
for i in range(N//INPUT[2]+1):
    remainder_1 = N-INPUT[2]*i
    for j in range(remainder_1//INPUT[1]+1):
        remainder_2 = remainder_1-INPUT[1]*j
        if remainder_2%INPUT[0] == 0:
            res += 1

print(res)

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

cnt = 0
for k in reversed(range(N // R + 1)):
  if N - k * R == 0:
    cnt += 1
    continue
  N1 = N - k * R
  for i in reversed(range(N1 // G + 1)):
    if N1 - i * G == 0:
      cnt += 1
      continue
    N2 = N1 - i * G
    if N2 % B == 0:
      cnt += 1
    else:
      continue
print(cnt)

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


count = 0
for i in range(3001):
    for j in range(3001):
        r = R * i
        g = G * j
        b = N - r - g
        if b % B != 0:
            continue
        if r + g + b == N and r >= 0 and g >= 0 and b >= 0:
            count += 1

print(count)

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

pat = 0
for r in range(N//R+1):
    rest = N - R*r
    for b in range(rest//B+1):
        if (rest-B*b) % G == 0:
            pat += 1
print(pat)

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


def solve():
    count = 0
    for r in range(0, N+1, R):
        rem = N - r
        count += sum(1 if (rem-g)%B == 0 else 0 for g in range(0, N-r+1, G))

    print(count)




solve()

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

r, g, b = int(N // R), int(N // G), int(N // B)

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

Solution (Python):
if __name__ == '__main__':
    import sys
    input = sys.stdin.readline

    r, g, b, n = map(int, input().split())
    ans = 0
    rgb = sorted([r,g,b], reverse=True)
    if rgb[1] == 1 and rgb[2] == 1:
        for i in range(n//rgb[0]+1):
            ans += (n-i*rgb[0]+1)
        print(ans)
        exit()
    for i in range(n//rgb[0]+1):
        for j in range((n-i*rgb[0])//rgb[1]+1):
            if (n-i*rgb[0]-j*rgb[1])%rgb[2]==0:
                ans+=1
    print(ans)

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

r = N // R
g = N // G
b = N // B

c = 0
for i in range(r+1):
    for j in range(g+1):
        n = N - i*R - j*G
        if n < 0:
            continue
        if n % B == 0:
            c += 1

print(c)

Solution (Python):
rgb = [ int(x) for x in input().split() ]
n = rgb.pop()
r,g,b = sorted( rgb,key=lambda x:-x )

cnt= 0
for i in range( int(n/r)+1 ):
    m = n - r * i
    for j in range( int(m/g)+1 ):
        l = m - g * j
        if l%b==0: cnt+=1

print( cnt )

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

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

res = 0

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

print(res)

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

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

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

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

Solution (Python):
from sys import stdin
import numpy as np
 
R, G, B, N = map(int,input().split())

lst = sorted([R, G, B], reverse=True)


cnt = 0
var_1 = N
while True: 
  var_2 = var_1
  while True: 
    if var_2 % lst[2] == 0:
      cnt += 1
    var_2 -= lst[1]
    if var_2 < 0:
      break
  var_1 -= lst[0]
  if var_1 < 0:
    break
    
print(cnt)

Solution (Python):

import sys


def solve(R: int, G: int, B: int, N: int):
    cnt= 0
    for r in range(0, N + 1, R):
        upper = N + 1 - r
        for g in range(0, upper, G):
            temp = upper-1-g
            if temp < 0:
                break
            b = temp / B
            if b % 1 == 0 and b >= 0:
                cnt += 1
            else:
                continue
    print(cnt)
    return



def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    R = int(next(tokens))  
    G = int(next(tokens))  
    B = int(next(tokens))  
    N = int(next(tokens))  
    solve(R, G, B, N)

if __name__ == '__main__':
    main()

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

Solution (Python):





import sys
input = sys.stdin.readline
R, G, B, N = map(int, input().split())




cnt = 0
a, b, c = sorted([R, G, B], reverse=True)


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




list(range(1//3 + 1))

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

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

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

x = 0

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

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

Solution (Python):
import itertools
r,g,b,n = map(int,input().split())
r_max,g_max,b_max = int(n/r),int(n/g),int(n/b)
ans = 0
for i,j in itertools.product(range(0,r_max+1),range(0,g_max+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, raw_input().split())

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

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

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

print(sum)

Solution (Python):
R,G,B,N=map(int,input().split())
ls=(sorted([R,G,B]))
mx,md,sm=ls[2],ls[1],ls[0]
count=0

biggest_box_max=N//mx
for i in range(biggest_box_max+1):
    rest_N=N-mx*i
    middle_box_max=rest_N//md
    for j in range(middle_box_max+1):
        rest_rest_N=rest_N-md*j
        if rest_rest_N%sm==0:
            count+=1
        
print(count)

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

c = 0
for n in range(N+1):
    for nn in range(n+1):
        if nn % R == 0 and (n - nn) % G == 0 and (N - n) % B == 0:
            c += 1
print(c)

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

Solution (Python):

import sys
import math
from bisect import bisect_left
from bisect import bisect_right
import collections
import copy
input = sys.stdin.readline
 


 
def main():
	R, G, B, N = map(int, input().split(" "))
	
	ans = 0
	for i in range(N+1):
		r = i * R
		for j in range(N+1):
			g = j * G
			if N - r - g < 0:
				continue
			if (N - r - g) % B != 0:
				continue
			
			
			ans += 1
			

	print(ans)

	
	
if __name__ == "__main__":
	main()

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

Max = max(R, G, B)
Min = min(R, G, B)
Mid = R+G+B - Max - Min
ans = 0

for i in range((N // Max) +1):
    rem1 = N - (i*Max)
    for j in range((rem1 // Mid) +1):
        rem2 = rem1 - (j*Mid)
        if rem2 % Min == 0:
            ans += 1

print(ans)

Solution (Python):
import sys

readline = sys.stdin.readline

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

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

print(count)

Solution (Python):
from collections import Counter
from collections import deque
from functools import reduce
from pprint import pprint

import bisect
import copy
import fractions
import math
import random
import sys
import time
sys.setrecursionlimit(10**7)
INF = 10 ** 18
MOD = 10 ** 9 + 7
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def MI(): return map(int, sys.stdin.readline().split())
def II(): return int(sys.stdin.readline())
def IS(): return input()
def C(x): return Counter(x)
def GCD_LIST(numbers):
    return reduce(fractions.gcd, numbers)
def LCM_LIST(numbers):
    return reduce(LCM, numbers)
def LCM(m, n):
    return (m * n // fractions.gcd(m, n))
def unite(x, y):
    
    x = root(x)
    y = root(y)
    if x == y:
        return
    
    node[x] = y
def same(x,y): return bool(root(x) == root(y))
def root(x):
    if node[x] == x:  
        return x
    else:
        node[x] = root(node[x])  
        return node[x]
def dfs(v):
    
    visited[v] = True
    for v2 in range(n):
        if graph[v][v2] == False:  
            continue
        if visited[v2] == True:  
            continue
        dfs(v2)

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


print(ans)

Solution (Python):
def main():
	R, G, B, N = map(int, input().split())
	r_max, g_max = N//R, N//G
	def search(ball, goal):
		if goal % ball == 0:
			return 1
		return 0
	ans = search(R, N)
	ans += search(G, N)
	ans += search(B, N)
	for r in range(1, r_max+1):
		if r*R >= N:
			break
		ans += search(G, N-r*R)
		ans += search(B, N-r*R)
		for g in range(1, g_max+1):
			if r*R+g*G >= N:
				break
			ans += search(B, N-r*R-g*G)

	for g in range(1, g_max+1):
		if g*G >= N:
			break
		ans += search(B, N-g*G)
	print(ans)


if __name__ == '__main__':
	main()

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

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

cnt = 0
for p0 in range(N//C[0]+1):
    p0v = p0*C[0]
    for p1 in range((N-p0v)//C[1]+1):
        p1v = p1*C[1]
        if (N - p0v - p1v)%C[2] == 0:
            cnt += 1
print(cnt)

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

Solution (Python):


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

ans = 0

for ri in range(0,n//r+1):

    t = n - ri*r
    if t<0:
        break
    
    for gi in range(0,t//g+1):
        tt = t -gi*g

        if tt<0:
            break
        if tt%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())
R, G, B = sorted([R, G, B])

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

print(i)

Solution (Python):

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

rmax = N // R

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

print(count)

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

N1 = n // l[2]
N2 = n // l[1]
N3 = n // l[0]

cnt = 0

for i in range(N1+1):
    N2 = n-i*l[2] // l[1]
    for j in range(N2+1):
        if ((n-i*l[2]-j*l[1]) % l[0] == 0) and ((n-i*l[2]-j*l[1]) // l[0] >= 0):
            cnt += 1
            
print(cnt)

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

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

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

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

print(ans)

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

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

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

print(cnt)

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

cnt = 0
num = N
for i in range(0,N+1,R):
    tmp = num - i
    for j in range(0,N+1,G):
        tmp2 = tmp - j
        if tmp2%B == 0 and tmp2 >= 0:
            cnt += 1

print(cnt)

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

for r in range(N + 1):
  for g in range(N + 1):
    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+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())
total=0
for i in range(int(N/R)+1):
    tmp_R=N-R*i
    if tmp_R==0:
        total+=1
    else:
        for j in range(int(tmp_R/G)+1):
            tmp_G=tmp_R-G*j
            if tmp_G==0:
                total+=1
            else:
                if tmp_G%B==0:
                    total+=1
print(total)

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

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

    count = 0
    for rr in range(n//r + 1):
        for gg in range((n-rr*r)//g + 1):
            if (n-rr*r-gg*g) % b == 0:
                count += 1
    print(count)

if __name__ == '__main__':
    main()

Solution (Python):
import sys, re

def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
MOD = 10 ** 9 + 7


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

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

Solution (Python):
r,g,b,n=list(map(int,input().split()))
ans=0
for gi in range(1,n+2):
  if (gi-1)%r!=0:
    continue
  else:
    for bi in range(gi,n+2):
      if (bi-gi)%g ==0 and (n-bi+1)%b==0 :
        ans+=1
print(ans)

Solution (Python):

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

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

Solution (Python):
R,G,B,N = map(int, input().split())
values = [R,G,B]
values.sort(reverse = True)
a,b,c = values
ans = 0
for i in range(N//a+1):
    p = N - a*i
    for j in range(p//b + 1):
        q = p - b*j
        if q%c == 0:
            ans += 1
print(ans)

Solution (Python):
R, G, B, N = map(int, input().strip().split(' '))
B, G, R = sorted([R, G, B])


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

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

Solution (Python):
R,G,B,N = map(int,input().split())
dp = [[0,0,0] for i in range(N + 1)]

for i in range(N + 1):
  if i % R == 0:
    dp[i][0] = 1

for i in range(N + 1):
  if dp[i][0] != 0:
    for j in range(i,N + 1,G):
      dp[j][1] += dp[i][0]
for i in range(N + 1):
  if dp[i][1] != 0:
    for j in range(i,N + 1,B):
      dp[j][2] += dp[i][1]
print(dp[-1][2])

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

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

Solution (Python):
R, G, B, N = list(map(int, input().split()))
 
count = len([1 for i in range(0, N+1, R) for j in range(0, N+1, G) if (N-i-j) % B == 0 and N >= (i+j)])
print(count)

Solution (Python):


from sys import stdout
import sys
from bisect import bisect_left as binl
from copy import copy, deepcopy


mod = 1


def intin():
    input_tuple = input().split()
    if len(input_tuple) <= 1:
        return int(input_tuple[0])
    return tuple(map(int, input_tuple))


def intina():
    return [int(i) for i in input().split()]


def intinl(count):
    return [intin() for _ in range(count)]


def modadd(x, y):
    global mod
    return (x + y) % mod


def modmlt(x, y):
    global mod
    return (x * y) % mod


def lcm(x, y):
    while y != 0:
        z = x % y
        x = y
        y = z
    return x


def combination(x, y):
    assert(x >= y)

    if y > x // 2:
        y = x - y

    ret = 1

    for i in range(0, y):
        j = x - i
        i = i + 1

        ret = ret * j
        ret = ret // i

    return ret


def get_divisors(x):
    retlist = []
    for i in range(1, int(x**0.5) + 3):
        if x % i == 0:
            retlist.append(i)
            retlist.append(x // i)
    return retlist


def get_factors(x):
    retlist = []
    for i in range(2, int(x**0.5) + 3):
        while x % i == 0:
            retlist.append(i)
            x = x // i
    retlist.append(x)
    return retlist


def make_linklist(xylist):
    linklist = {}
    for a, b in xylist:
        linklist.setdefault(a, [])
        linklist.setdefault(b, [])
        linklist[a].append(b)
        linklist[b].append(a)
    return linklist


def calc_longest_distance(linklist, v=1):
    distance_list = {}
    distance_count = 0
    distance = 0
    vlist_previous = []
    vlist = [v]
    nodecount = len(linklist)

    while distance_count < nodecount:
        vlist_next = []
        for v in vlist:
            distance_list[v] = distance
            distance_count += 1
            vlist_next.extend(linklist[v])
        distance += 1
        vlist_to_del = vlist_previous
        vlist_previous = vlist
        vlist = list(set(vlist_next) - set(vlist_to_del))

    max_distance = -1
    max_v = None
    for v, distance in distance_list.items():
        if distance > max_distance:
            max_distance = distance
            max_v = v

    return (max_distance, max_v)


def calc_tree_diameter(linklist, v=1):
    _, u = calc_longest_distance(linklist, v)
    distance, _ = calc_longest_distance(linklist, u)
    return distance




cache = {}


def calc_pattern2(x, a, b):
    global cache

    if (x, a, b) in cache:
        return cache[(x, a, b)]
    if x < 0:
        return 0
    if x == 0:
        return 1

    ans = 0

    ans += calc_pattern2(x - a - b, a, b)

    if x % a == 0:
        ans += 1
    if x % b == 0:
        ans += 1

    cache[(x, a, b)] = ans
    return ans


def calc_pattern3(x, a, b, c):
    global cache

    if (x, a, b, c) in cache:
        return cache[(x, a, b, c)]
    if x < 0:
        return 0
    if x == 0:
        return 1

    ans = 0

    ans += calc_pattern3(x - a - b - c, a, b, c)

    ans += calc_pattern2(x - a - b, a, b)
    ans += calc_pattern2(x - b - c, b, c)
    ans += calc_pattern2(x - c - a, c, a)

    if x % a == 0:
        ans += 1
    if x % b == 0:
        ans += 1
    if x % c == 0:
        ans += 1

    cache[(x, a, b, c)] = ans
    return ans


def main():
    sys.setrecursionlimit(5000)
    r, g, b, n = intin()
    print(calc_pattern3(n, r, g, b))


if __name__ == '__main__':
    main()

Solution (Python):
R,G,B,N = (int(i) for i in input().split())
P = N//R
ans = 0
count1=0
count2=0
for i in range(P+1):
    left = N - i*R
    Q = left//G
    for j in range(Q+1):
        left1 = left - j*G
        if left1%B == 0:
            ans +=1
print(ans)

Solution (Python):
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,copy,functools
import random

sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**10
mod = 10**9+7
dd = [(-1,0),(0,1),(1,0),(0,-1)]
ddn = [(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(): return [list(map(int, l.split())) for l in sys.stdin.readlines()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def pf(s): return print(s, flush=True)
def pe(s): return print(str(s), file=sys.stderr)


def main():
    a,b,c,n = LI()
    r = 0
    for i in range(0,n+1,a):
        t = n - i
        for j in range(0,t+1,b):
            k = t - j
            if k % c == 0:
                r += 1

    return r


print(main())